Anonymous User 16850768
(@anonymized-16850768)
To disable caching for logged in users (default behavior) you’ll need to ensure the cookies regex option in the Cache Exclusions setting is handling this, like excluding the wordpress_logged_in_ cookie.
You can customize this to only disable caching for admin users if needed. For example, the following snippet could be added to your functions.php file:
$user = wp_get_current_user();
if ( in_array( 'Administrator', (array) $user->roles ) ) {
setcookie( 'user_admin', 1 );
}
The above snippet would set the user_admin=1 cookie for admin users. You could then exclude the user_admin cookie. That would cause the cache to be bypassed for admin users but cached for all other user types.
Tip: I use the My Custom Functions plugin [by Space-x chimp].
It’s perfect if you don’t have a child theme with a custom functions file or a custom functions file that won’t get overridden by your theme when it updates.