• Hello there,

    I am currently responsible for managing a WooCommerce store, where we have WP Super Cache implemented. For obvious reasons, we have “Don’t cache pages for known users. (Recommended)” enabled, however when a customer logs into the website they too bypass the caching engine. This can be quite a big problem when a large surge of customers hit the site after a mailing campaign.

    If anyone can suggest how we can restrict the role to not include customers, that would be very helpful. Otherwise we are a bit stuck up the creek, server currently peaks on CPU!

    Thank you so much for your help.

    Kind Regards,
    Tim

Viewing 2 replies - 1 through 2 (of 2 total)
  • @tneville I have a similar situation where we need to keep our site cached for logged in users and we need to be able to see the noncached pages as the admin to review changes, etc. In this case I don’t select the option “Don’t cache pages for known users”. When I need to see the noncached version of a page without clearing cache I use mysite.com/my-page/?donotcachepage=mysecretkey

    You can find your do not cache page secret key on the Advanced tab and you can modify it in /wp-content/wp-cache-config.php We have set ours to an easy secret key so that we can remember it.

    Alternatively, you could add a conditional rule to your theme header.php that would fire for your user permissions to not cache. This would stop caching for your user permissions (presumably admin) but continue to serve cache for all other permissions:

    <?php if ( current_user_can('manage_options') ) {define('DONOTCACHEPAGE',1);} else { echo "";} ?>

    I have not used this specific code in the header.php, however, I have used it without the conditional statement on a variety of page templates that I don’t want cached and it works like a charm and I have used other similar conditional rules in the header.php and those have always worked well. I imagine that combining the two should also work.

    Cheers,
    Pat

    Thread Starter Tim

    (@tneville)

    Hi Pat,

    Thanks for getting back to me on this, ah, I had forgotten about the secret key! I shall set that up as there is only myself and two store admins working on the site so it should be a suitable solution.

    If that doesn’t work I shall be straight back to this thread to try your code. It looks like it’ll work to me. ??

    Kind Regards,
    Tim

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Don’t cache pages for known users. – Admin Only’ is closed to new replies.