Open roryashfordbentley opened 2 years ago
WP use wp_get_nocache_headers() to set no-cache headers for logged in users.
It seams, You can modify this header to control cashing in Surge. Example: somewhere in the theme's functions.php:
add_action( 'wp', function(){
if( is_user_logged_in() ){
header_remove( 'Cache-Control' );
}
} );
I tried using the header_remove() code snippet above, and it wasn't working properly for me. I tried nocache_headers() instead, and that seems to be working.
https://developer.wordpress.org/reference/functions/nocache_headers/
Hey, first of all thanks for the excellent plugin, it works incredibly well out of the box!
I have been poking through the plugin source code and I can't seem to find the logic that disables/prevents caching for logged in users.
What I am hoping is possible is that I can create a custom config file like this Surge Configuration Example. And setup some logic to enable caching for logged in users with a certain custom role (essentially a role that only has frontend access).
If you could point me in the direction of how Surge currently identifies logged in users I'd really appreciate it.