Some info from the debug log, could it be because I have a snippet in the functions that intercepts cache and disable it for logged users?? The reason I had this done in the past as I found that some pages get cached with logged user info and get indexed by Google!
20:37:49 102 / wpsc_get_auth_cookies: cookies detected: wordpress_logged_in_abcd_xxxxx
20:37:49 102 / wpsc_is_caching_user_disabled: true because logged in
20:37:49 102 / Caching disabled for logged in users on settings page.
20:37:49 102 / Supercache Late Init: add wp_cache_serve_cache_file to init
20:37:49 102 / Supercache Late Loader running on init
20:37:49 102 / ACCEPT: text/html
20:37:49 102 / wp_cache_get_cookies_values: Login/postpass cookie detected
20:37:49 102 / wp_cache_get_cookies_values: return: xxxabcd
20:37:49 102 / supercache dir: ABSPATH/wp-content/cache/supercache/www.capitano.om/
20:37:49 102 / No Super Cache file found for current URL: ABSPATH/wp-content/cache/supercache/www.xyz.com/index-https.html
20:37:49 102 / ***********************************************************************************
20:37:49 102 / * An extra output buffer has been detected. Check your plugins, themes, *
20:37:49 102 / * mu-plugins, and other custom code as this may interfere with caching. *
20:37:49 102 / * Late init is enabled. This allows third-party code to run before WP Super Cache *
20:37:49 102 / * sets up an output buffer. That code may have set up the output buffer. *
20:37:49 102 / ***********************************************************************************
20:37:49 102 / In WP Cache Phase 2
20:37:49 102 / Setting up WordPress actions
20:37:49 102 / Created output buffer
20:37:49 102 / wp_cache_get_cookies_values: cached: abcd_123_xxx
20:37:49 102 / wp_cache_replace_line: changing line $cache_enabled = true; to *$cache_enabled = false;*
20:37:49 102 / wp_cache_replace_line: writing to ABSPATH/wp-content/cache/123_xyz_xxxx.php
20:37:49 102 / wp_cache_replace_line: moved ABSPATH/wp-content/cache/123_xyz_xxxx.php to ABSPATH/wp-content/wp-cache-config.php
20:37:49 102 / wp_cache_disable: disable cache
20:37:50 102 / DONOTCACHEPAGE defined. Caching disabled.
20:37:50 102 / wp_cache_maybe_dynamic: returned $buffer
function prevent_cache_for_logged_in_users() {
if ( is_user_logged_in() ) {
// Prevent caching by setting the necessary headers
nocache_headers();
// If using a caching plugin like W3 Total Cache or WP Super Cache, set their specific headers
if ( defined( 'DONOTCACHEPAGE' ) === false ) {
define( 'DONOTCACHEPAGE', true );
}
// For other caching plugins, setting the DONOTCACHEPAGE constant is usually enough
// However, if you use a caching plugin that requires specific headers, add them here:
// For WP Super Cache:
if ( function_exists( 'wp_cache_disable' ) ) {
wp_cache_disable();
}
// For W3 Total Cache:
if ( function_exists( 'w3tc_pgcache_flush' ) ) {
w3tc_pgcache_flush();
}
}
}
add_action( 'template_redirect', 'prevent_cache_for_logged_in_users' );
function add_noindex_nofollow_to_headers() {
if ( is_user_logged_in() ) {
echo '<meta name="robots" content="noindex, nofollow, nosnippet, noarchive">';
}
}
add_action( 'wp_head', 'add_noindex_nofollow_to_headers' );
-
This reply was modified 2 months, 2 weeks ago by yabdali.
-
This reply was modified 2 months, 2 weeks ago by yabdali.