• Hello good morning.

    First of all thank ?? you for the wonderful plugin you have made, it’s great??.

    I have a problem with caches, me and half the world ?? .

    I use SiteGround, Kinsta and others, the problem is the same on all hosting.

    I accept cookies but the blocked content is not seen because it is being served with cache, normal.

    If I disable the cache, the plugin works perfect.

    I want to know how to bypass the cache if the “cookies_and_content_security_policy” cookie of the plugin is present.

    I know Siteground bypasses the cache if these cookies are present:

    wordpress_logged_in_, yith_wcwl_products, wp-postpass_, edd_items_in_cart=1, it_exchange_session_, wp_woocommerce_session, woocommerce_cart_hash, woocommerce_items_in_cart=1, Drupal.visitor.name, drupalSGCacheBypass=1, jSGCacheBypass=1, wpSGCacheBypass=1.

    I have in my functions.php

    add_action('init', function() {
        if (isset($_COOKIE['cookies_and_content_security_policy'])) {
               if ( class_exists( 'SiteGround_Optimizer\Supercacher\Supercacher' ) ) {
            SiteGround_Optimizer\Supercacher::purge_cache();
        }
          }
    });

    With this code everything works but in order to see the blocked content the user has to click on accept cookies and refresh the page ??.

    I have found in Github a code that they use to deactivate the caches of many hosting: https://github.com/WPHercules/wph-server-cache-helper/blob/master/wph-server-cache-helper.php

    I don’t know if you can do something to implement that code in your plugin to disable caches when accepting cookies.

    Or if you can do something to make the page reload when you click the accept cookies button, I know it’s not perfect but it’s better than nothing.

    Can you help me?

    Thank you very much ??.`

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Johan Jonk Stenstr?m

    (@jonkastonka)

    Sorry to hear that. The page is reloaded when you accept/save settings. You should probably use a better cache solution like a server cache, object cache or Cloudflare.

    What cache plugin are you using?

    Thread Starter Juan Luis Martel

    (@usblsb)

    ?? Sorry for taking so long to respond.
    Sorry for taking so long to say ?? thank you.
    This is a very busy date, I am Santa’s technician.


    I have been trying a lot of things.
    I use Siteground hosting.
    The cache plugin is the official Siteground plugin, Siteground Optimizer.


    Site ground shows pages without cache if some types of cookies are active.
    I left the list of active cookies in the initial question.


    I have created a plugin that when your cookie is active, it activates the woocommerce cookie and so more or less works the cache, but it is not the right thing to do.


    ??*Maybe you could think about including something like that in this plugin.
    That when the cookie of your plugin is active, it activates a cookie of WooCommerce or similar, so that it is compatible with the cache plugins of the hostings.


    ??</img>Just that.
    ??</img>Thank you for your fantastic plugin.
    It works very well for me, and I am very happy.
    I just try to activate the caches, to improve the speed of the web and also to reduce the electrical consumption of the hostings.


    I wish you a Merry Christmas and a Happy New Year.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bypass cache if a cookie is present.’ is closed to new replies.