Title: WP Rocket Cache
Last modified: June 8, 2022

---

# WP Rocket Cache

 *  Resolved [christian70](https://wordpress.org/support/users/christian70/)
 * (@christian70)
 * [4 years ago](https://wordpress.org/support/topic/wp-rocket-cache-3/)
 * I’m using GDPR Cookie Compliance Plugin along with WP Rocket Cache. Two of my
   favourite and most useful plugins.
 * I need to show different content according to the cookies choices (i.e.: show
   YouTube videos if third-party cookies are accepted or a picture with warning 
   if they are not).
 * So I used the native PHP hooks:
    `if ( gdpr_cookie_is_accepted( 'thirdparty' )){...}
   else { ... }` and then force page reload: `add_action( 'gdpr_force_reload', '
   __return_true' )`
 * Unfortunately it doen’t work if caching is enabled.
    I wonder if there’s a way
   to load uncached page, for example by adding a specific query string to the url
   before reloading and using that query string as exception in cache settings.
 * Any suggestion to make the plugins work together will be highly appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [christian70](https://wordpress.org/support/users/christian70/)
 * (@christian70)
 * [4 years ago](https://wordpress.org/support/topic/wp-rocket-cache-3/#post-15719731)
 * Ok I realized that WP Rocket Cache gives the possibility to create different 
   cached versions of the same pages according to the value of a cookie. This is
   a solution.
 * Another one could be to use Ajax in order to load different template parts according
   to the value of moove_gdpr_popup cookie. About that, how to ckeck if third-party
   cookies have been accepted in JS?
 * I saw Javascript consent variables in documentation but I didn’t understand how
   to use them…
 *  Plugin Author [Moove Agency](https://wordpress.org/support/users/mooveagency/)
 * (@mooveagency)
 * [4 years ago](https://wordpress.org/support/topic/wp-rocket-cache-3/#post-15720362)
 * Hi [@christian70](https://wordpress.org/support/users/christian70/)
 * Thanks for using our plugins.
 * Our plugin has the following 3 consent variables implemented by default for each
   cookie category:
 * `gdpr_consent__strict` => values: true or false
    `gdpr_consent__thirdparty` =
   > values: true or false `gdpr_consent__advanced` => values: true or false
 * You also have a single variable that includes all categories that the user accepted:
 * `gdpr_consent__cookies` => values: strict|thirdparty|advanced or strict|thirdparty
   or strict|advanced
 * These consent variables can be used to configure your WP Rocket Cache and can
   be read using javascript.
 * Hope this helps.
 *  Thread Starter [christian70](https://wordpress.org/support/users/christian70/)
 * (@christian70)
 * [4 years ago](https://wordpress.org/support/topic/wp-rocket-cache-3/#post-15720501)
 * Do you mean:
 *     ```
       $(document).ready(function(){
          if (gdpr_consent__thirdparty = true) {
            do something...
          }
       });
       ```
   
 *  ?
    Because it doesn’t work, it can’t read the correct value if I change my cookies
   choice and reload the page.
    -  This reply was modified 4 years ago by [christian70](https://wordpress.org/support/users/christian70/).
 *  Thread Starter [christian70](https://wordpress.org/support/users/christian70/)
 * (@christian70)
 * [4 years ago](https://wordpress.org/support/topic/wp-rocket-cache-3/#post-15723164)
 * The point is that the values of `gdpr_consent__thirdparty` or `gdpr_consent__cookies`
   are cached. So they are useless in order to print different content according
   to them. The only way I found is to get directly the values of the cookie `moove_gdpr_popup`
   that is updated via Ajax.
 *  Plugin Author [Moove Agency](https://wordpress.org/support/users/mooveagency/)
 * (@mooveagency)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/wp-rocket-cache-3/#post-15726037)
 * Hi [@christian70](https://wordpress.org/support/users/christian70/)
 * You are right, WP Rocket caches our cookie. To prevent this, the “moove_gdpr_popup”
   cookie needs to be excluded from caching in WPRocket -> Advanced Rules -> Never
   Cache Cookies.
 * More details:
    [https://www.dropbox.com/s/9i4lnlpc14neywb/Screenshot_2022-06-10_at_13.32.44.png?dl=0](https://www.dropbox.com/s/9i4lnlpc14neywb/Screenshot_2022-06-10_at_13.32.44.png?dl=0)
 * Hope this helps.
 *  Thread Starter [christian70](https://wordpress.org/support/users/christian70/)
 * (@christian70)
 * [3 years, 12 months ago](https://wordpress.org/support/topic/wp-rocket-cache-3/#post-15731574)
 * Sorry but this is not an option: if I exclude “moove_gdpr_popup” cookie from 
   caching, all pages and all posts, the whole content of the site is not cached.
   So there’s no sense in using a cache plugin. Ajax is the only solution working
   for me.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘WP Rocket Cache’ is closed to new replies.

 * ![](https://ps.w.org/gdpr-cookie-compliance/assets/icon-256x256.png?rev=2376316)
 * [GDPR Cookie Compliance - Cookie Banner, Cookie Consent, Cookie Notice for CCPA, EU Cookie Law](https://wordpress.org/plugins/gdpr-cookie-compliance/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gdpr-cookie-compliance/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gdpr-cookie-compliance/)
 * [Active Topics](https://wordpress.org/support/plugin/gdpr-cookie-compliance/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gdpr-cookie-compliance/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gdpr-cookie-compliance/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [christian70](https://wordpress.org/support/users/christian70/)
 * Last activity: [3 years, 12 months ago](https://wordpress.org/support/topic/wp-rocket-cache-3/#post-15731574)
 * Status: resolved