Are you looking for a way to extend the auto logout period? This snippet will extend the time the authentication cookie will expire to one week.
Instructions:
Add this code to your theme’s functions.php file or in a site-specific plugin. Note the returned value is defined in seconds.
function logged_in( $expirein ) { return 604800; // 1 week in seconds } add_filter( 'auth_cookie_expiration', 'logged_in' );
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 6 Best WordPress Security Plugins Compared.
Could you advice us how to manually (without plugin) configure wordpress for idle user logout?
Nice snippet, but is it possible to force logout user if accessing a specific page?