I want to logout user autometically when user is idle for more than 10 minutes.That mean suppose user is logged in to a site and user didn't browse any pages for more than 10 mins.when he browse any page after 10mins, it will logout user and redirect to login page.Any Solution? Advance Thanks.


You just need to add your filter hook like this:

function myplugin_cookie_expiration( $expiration, $user_id, $remember ) {
    return $remember ? $expiration : 600;
add_filter( 'auth_cookie_expiration', 'myplugin_cookie_expiration', 99, 3 );

You can add it to your theme’s functions.php file.

  • First, thanks for the hooks. I want to know if it is possible to change the background when the user is logout (for security reason) and don't stay on the content page of admin ? – sampaii Nov 15 '17 at 13:38

protected by Community Aug 3 '16 at 10:51

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.