Force WordPress user to logout after inactivity
Published: 27, Oct 2014
PHPWordPress
You can use the following snippet to force the end user to logout after a period of inactivity.
function kc_cookie_expiration( $expiration, $user_id, $remember ) { return $remember ? $expiration : 600; } add_filter( 'auth_cookie_expiration', 'kc_cookie_expiration', 99, 3 );
Simply update the amount of time In this example 600) to the amount of seconds you want to go with before forcing the user to log out.