Look in wp-cache-phase1.php at the wp_cache_get_cookies_values() function. There’s a “cache_action” there called “wp_cache_get_cookies_values” that you can use as a filter to modify the cookie used to cache the page with. You can probably add your cookie to that string.
You’ll have to add this function as a Supercache plugin so it loads really early in the WordPress process.
Donncha, thanks very much for the help! Unfortunately I can’t seem to get this to work. I tried creating a custom function in wp-cache-phase1.php with the ‘wp_cache_get_cookies_values’ but I think I am using it incorrectly:
function get_the_src() {
$cook = $_COOKIE[‘cookiename’];
$str = do_cacheaction( ‘wp_cache_get_cookies_values’, $cook );
return $str;
}
I’m having the same problem, where it is retrieving the cookie value that is stored in the cache — not the updated cookie values.
It does not seem like there is any way to assign the cookie to a PHP variable before the Supercache plugin loads. It is very frustrating, as a lot of my PHP is rendered useless without being able to read the cookies properly for each user.
I am not a very experienced with WP, so I apologize if this is not what you were suggesting. Any further assistance would be greatly appreciated.
-
This reply was modified 8 years, 7 months ago by
froppitmf.
Hi @froppitmf
I have the same problem using WP Super Cache. Did you find a solution working with cookies and WP Super cache?
@donncha, Could you post here an example please? Sorry but I didn’t understand your reply.
Thank you.
-
This reply was modified 8 years, 5 months ago by
raualvron.
Take a look at the plugins/searchengine.php file. Once you start adding to the list of cookies those pages will be stored as wp-cache files with the cookie used in the key to identify the cached file.
RFC2109:
“If the cookie is intended for use by a single user, the Set-cookie
header should not be cached. A Set-cookie header that is intended to
be shared by multiple users may be cached.”
How does WP Super Cache handle nonces? Does it serve up the same nonces to all its visitors during the cache lifetime?