stay logged
Is it possible to stay logged in without having to enter my email address and password every time? When I click on the “stay logged in” box, it doesn't work. Thank you for your help.
I have a PHP code snippet for persistent login. Never tried it on a FC site, but I think it will work:
<?php
// Set login cookie to 10 years
add_filter('auth_cookie_expiration', function($expire, $user_id, $remember){
return 10 * YEAR_IN_SECONDS; // 10 years
}, 99, 3);
Aaron Liang Check out another option. What do you think?
// Always keep the user in the system for 6 months
add_filter('auth_cookie_expiration', function($expiration, $user_id, $remember){
return 6 * MONTH_IN_SECONDS;
}, 10, 3);
// Cookie extension upon login
add_action('wp_login', function($user_login, $user){
wp_clear_auth_cookie();
wp_set_auth_cookie($user->ID, true, is_ssl());
}, 10, 2);
