Keep Users Logged In As Long As I Like

What you found is actually perfectly accurate. With WP’s commitment to backwards compatibility it’s not that common for thing to stop working. This filter is used in wp_set_auth_cookie() to calculate the duration. Resulting value is used in PHP’s setcookie(). There is no mention of specifics limits in documentation, so in practice the value is limited … Read more

Should wordpress_logged_in cookie exist while logged out?

The function wp_logout (https://github.com/WordPress/WordPress/blob/master/wp-includes/pluggable.php#L564) calls the function wp_clear_auth_cookie (https://github.com/WordPress/WordPress/blob/master/wp-includes/pluggable.php#L928) which sets the expiration dates of all involved cookies to something in the past. Also for the LOGGED_IN_COOKIE. Hence, what you observe is strange. For sites that I maintain, the cookie will be cleared when I log out.

Using wp_set_auth_cookie for custom user account system

Why are you building a seperate user system in the first place? The wordpress builtin system is pretty flexible. In theory all the login functions like wp_set_auth_cookie(), wp_generate_auth_cookie(), wp_parse_auth_cookie() etc. are all pluggable functions. Which means you can replace them with your own custom functions. But to be realistic, it will be a lot of … Read more

How to change cookie name

Check out the wp_cookie_constants() and ms_cookie_constants() functions, to see available cookies. We can try this in the wp-config.php file: // Here we just simulate how it’s done in the core define( ‘COOKIEHASH’, md5( ‘http://example.tld’ ) ); // Then we override the cookie names: define( ‘USER_COOKIE’, ‘wpse_user_’ . COOKIEHASH ); define( ‘PASS_COOKIE’, ‘wpse_pass_’ . COOKIEHASH ); … Read more

Extending auth_cookie_expiration based on user role

Untested, but the following should only change the expiration time for admins who select ‘remember me’. function wpse108399_change_cookie_logout( $expiration, $user_id, $remember ){ if( $remember && user_can( $user_id, ‘manage_options’ ) ){ $expiration = 60;// yes, I know this is 1 minute } return $expiration; } add_filter( ‘auth_cookie_expiration’,’wpse108399_change_cookie_logout’, 10, 3 );

COOKIE_DOMAIN setting confusion

As cdn.mydomain.com is not part of your WordPress network, it wont be affected by your settings. The COOKIE_DOMAIN constant should only be used if you want to serve cookies from a single domain for all your sites in the network. If you omit the constant or set it to an empty value, cookies will belong … Read more