By default the login cookie lasts for
- 14 days if you tick ‘remember me’
- 48 hours if you don’t
So as a short term fix you probably want to tick ‘remember me’, and to extend that to 30 days you can add an auth_cookie_expiration filter e.g.
function auth_cookie_expiration_30_days( $seconds, $user_id, $remember_me ) {
if ( $remember_me ) {
return 30 * DAY_IN_SECONDS;
}
return $seconds;
}
add_filter( 'auth_cookie_expiration', 'auth_cookie_expiration_30_days', 10, 3 );
As you can see you can set per-user-ID durations and you can change the don’t-remember-me time here too if you want, although above I’m leaving that as the default.
Related Posts:
- How do I get the current edit page ID in the admin?
- Can’t get post ID in functions.php?
- Get user id from email?
- Session is not starting
- WordPress Website with Login system
- get_current_user_id() always return 0 in if else statement
- Author Page User id in functions.php for non login user
- Syling Custom Fields echo’s from from functions.php
- Using array page name together with page id to deregister script
- get USER ID in functions.php using user_register action
- Sessions in word press [duplicate]
- Ajax call always returns 0
- How to override a function when isn’t at functions.php
- Where and how to put inline js in pages
- contactform7 remove tags with “wpcf7_autop false” from functions.php
- How to count number of functions attached to an action hook?
- Show modified time if post is actually modified
- ajax live search for post title
- Hourly Routine Not Firing ( wp_schedule_event() )
- How to get an array of menu items from the toolbar?
- Fatal error: Call to undefined function add_action() – an untouched problem
- echo or print_r in an admin function
- Overriding methods in a child theme
- Automatically Add Specified Value to Attachment Metadata upon Upload
- WP disobeys disabling of the posts revision feature
- Twenty Eleven Child theme error when attempting to use a rewritten function
- is_dynamic_sidebar always returns true while using Jetpack visibility
- wp_trash_post function to only apply to posts, not pages!
- Adding widget to dashboard with wp_dashboard_setup not working
- qTranslate in functions.php
- Using Schema with `the_excerpt`
- Image rotation fails to regenerate custom sized thumbnail
- Register and load scripts
- Having a Function Inside of the Loop
- Display alert on successful user Sign Up
- Getting different functions data while using while loop in wordpress
- How to rewrite the custom url in wordpress?
- About cron delete user with meta_key
- Unable to login using username
- How to change the order of Jquery in the footer of my theme?
- Set spesific size of featured images
- media resize/crop possibilities?
- adding custom script to functions file
- edit formatting.php in a theme so it wont get overwritten
- Get arguments from URL
- add_action template_redirect not working for home page
- Way to store featured image width and height in two separate variables?
- Insert template-part inside the content
- Can’t Write Custom Widget Code In One ECHO
- Got white blank page after copying the functions.php to child theme
- Add unique id to Preview URL
- Numbering lines of code with the tag?
- Latest Foursquare Checkin function
- Functions php shortcode for displaying main menu with no child items
- Redirect to other page if login
- first paragraph of the_content as meta description
- get_terms (or tax_query) for term of current post?
- 404 when enqueue_script using plugin_url
- WP Customizer API loaded into functions.php
- Do we need to change our child function.php to require/include child dir files when we add an over-riding file.php into the child theme
- How to use get_posts() function in functions.php
- Redirect to post after publish or update a published post
- Page Template Won’t Load Correct CSS File
- the_widget() inside functions.php
- How Can I add a menu to the theme from withen the function.php file
- the_excerpt function not showing image
- How to display this meta data (an array) in form of a function (created with a custom write panel)?
- WordPress – using sessions?
- Use a filter for wp_robots to block CPT/feed/
- Trigger email alert if file downloaded
- Completely Disable WordPress RSS Feeds
- How to hide content on mobile in the functions.php file – woocommerce
- Load templates, pass arguments, and render output from functions.php
- Order column custom date using pre_get_posts
- query_vars treat as single var from URL
- Running javascript without hooking wp_head
- WordPress Lite/Light
- Remove text after a dot and a colon in Woocommerce product title
- Selecting specific query for offset
- Is_Page doesnt detect my page
- Show image after X para – center aligned
- Problems adding a new field to product in cart
- Function for Sticky Post on Categories causes issues with 404 behavior
- what is `get_section()` and how to use it?
- function replace_text for entire page
- Get value of pre-populated Gravity forms field as variable in my function
- Only Show One Category Name Per Post
- Pass max posts to Javascript
- update_usermeta don’t work
- Create html from function
- WP supersize not displaying when different languages flags are selected
- wp_list_pages change of children and anchor of parent
- Admin Panel errors because of functions.php
- WordPress not performing direct update
- Using Output from one Function and calling it into another
- How to add a class and title attribute to the link generated by next/previous post
- “Headers already sent” while trying to add a CSS file to my login page?
- Notice: Use of undefined constant REQUEST_URI – assumed ‘REQUEST_URI’ in ….functions.php on line 73
- Bulk set Post Title as Tag where Tag is Empty Function
- How to add more than one menu for logged in members?