Here’s one milder suggestion to try out, assuming different cookie domains, if you’re using WordPress 5.5+
For your development installs, set the getenv environment variable WP_ENVIRONMENT_TYPE
or define:
define( 'WP_ENVIRONMENT_TYPE', 'development' );
within the corresponding wp-config-development.php
or the name you use for it.
Then extend the authentication cookie expiration period for the development installs with e.g.
add_filter( 'auth_cookie_expiration', function( $ttl, $user_id, $remember ) {
// Adjust to your working environment needs.
$my_working_types = [ 'development' ];
$my_working_ttl = YEAR_IN_SECONDS;
return in_array( wp_get_environment_type(), $my_working_types, true )
? $my_working_ttl
: $ttl;
}, PHP_INT_MAX - 1, 3 );
So you would have to login once to start with, checking the “Remember me” on the login screen, else we get the session expiration.
There are four supported environment types of wp_get_environment_type()
supported:
- local
- development
- staging
- production (default)
See the dev notes for the back story.
ps: The setup of using the same domain, with multiple sites in sub-directories, sharing the same WordPress install, reminds me of WordPress multisite.