Title: [open_now] and [closed_now] don&#8217;t update with WP Rocket cache enabled
Last modified: August 26, 2022

---

# [open_now] and [closed_now] don’t update with WP Rocket cache enabled

 *  Resolved [tmnewslang](https://wordpress.org/support/users/tmnewslang/)
 * (@tmnewslang)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/shortcode-doesnt-update-with-wp-rocket-cache-enabled/)
 * Hi,
 * First off, great free plugin, the best I’ve seen on the subject, very simple 
   yet feature rich and powerful.
 * I have a problem with caching. I have the following code inside an Elementor 
   shortcode widget :
 *     ```
       <a href="#pratique">
       [open_now]Nous sommes ouverts[/open_now]
       [closed_now]Nous sommes fermé actuellement[/closed_now]
       </a>
       ```
   
 * Basically, it simply shows either of value if the store is opened or closed. 
   And I have a CSS rule that hides the value depending on the class (show, hide)
   returned by your plugin.
 * I use WP Rocket on my website and when caching is enabled, it seems like the 
   shortcode is not being executed each time we reload the page, because this info
   don’t update.
 * I know this maybe a WP Rocket problem, but I wanted to check it out with you 
   first, is there any JavaScipt being applied with these shortcodes ? Or is it 
   simply PHP code being executed ?
 * What’s strange is that I never had problem with other shortcodes and WP Rocket
   to my knowledge.
 * Do you have any idea what might be causing this problem ? For now the website
   doesn’t cache the home page (where the text is shown, at the top of the page),
   but this kind of defeat the purpose of WP Rocket 🙂
 * Let me know, thanks !
    -  This topic was modified 3 years, 7 months ago by [tmnewslang](https://wordpress.org/support/users/tmnewslang/).
    -  This topic was modified 3 years, 7 months ago by [tmnewslang](https://wordpress.org/support/users/tmnewslang/).
    -  This topic was modified 3 years, 7 months ago by [tmnewslang](https://wordpress.org/support/users/tmnewslang/).
    -  This topic was modified 3 years, 7 months ago by [tmnewslang](https://wordpress.org/support/users/tmnewslang/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fshortcode-doesnt-update-with-wp-rocket-cache-enabled%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Noah Hearle](https://wordpress.org/support/users/designextreme/)
 * (@designextreme)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/shortcode-doesnt-update-with-wp-rocket-cache-enabled/#post-15952833)
 * [@tmnewslang](https://wordpress.org/support/users/tmnewslang/) I have covered
   this a few times in the forum – you need to add the following to your Shortcode
   to get around page caching:
 *     ```
       <a href="#pratique">
       [open_now update="immediate"]Nous sommes ouverts[/open_now]
       [closed_now update="immediate"]Nous sommes fermé actuellement[/closed_now]
       </a>
       ```
   
 *  Plugin Author [Noah Hearle](https://wordpress.org/support/users/designextreme/)
 * (@designextreme)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/shortcode-doesnt-update-with-wp-rocket-cache-enabled/#post-15952847)
 * [@tmnewslang](https://wordpress.org/support/users/tmnewslang/) Thanks for the
   great comment:
 * > First off, great free plugin, the best I’ve seen on the subject, very simple
   > yet feature rich and powerful.
 * Please leave a review if you like it! 🙂
 *  Thread Starter [tmnewslang](https://wordpress.org/support/users/tmnewslang/)
 * (@tmnewslang)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/shortcode-doesnt-update-with-wp-rocket-cache-enabled/#post-15952850)
 * Thanks for the very quick answer. Sorry if my question is a duplicate. But I 
   just tried this and it doesn’t work…
 *  Plugin Author [Noah Hearle](https://wordpress.org/support/users/designextreme/)
 * (@designextreme)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/shortcode-doesnt-update-with-wp-rocket-cache-enabled/#post-15952915)
 * [@tmnewslang](https://wordpress.org/support/users/tmnewslang/) Oh, you will need
   to clear the page cache once adding this parameter.
 * I am checking the URL and it is correct now (open at Friday, 14:30).
 * If you want to test the current time, please use this:
 * `[open_text update="immediate"]%now%[/open_text]`
 * It should say the current time (on page load).
 *  Plugin Author [Noah Hearle](https://wordpress.org/support/users/designextreme/)
 * (@designextreme)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/shortcode-doesnt-update-with-wp-rocket-cache-enabled/#post-15952967)
 * [@tmnewslang](https://wordpress.org/support/users/tmnewslang/) I have checked
   the page and I can see the JavaScript AJAX call is running correctly and it’s
   returning the correct data (you can see this in the browser’s Developer Console
   | Network : _admin-ajax.php_).
 * Are you sure this is still not working?
 *  Thread Starter [tmnewslang](https://wordpress.org/support/users/tmnewslang/)
 * (@tmnewslang)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/shortcode-doesnt-update-with-wp-rocket-cache-enabled/#post-15953030)
 * Sorry, I had to deactivate the caching to avoid the problem for my client during
   this afternoon. I just reactivated it, you can see it’s not working.
 * With the cache activated, even if I change the store schedules (they’re shown
   at the bottom of the homepage), they don’t update. But since this is not really
   someting that happens often, it’s not too much of a problem for them, we can 
   clear the cache manually if needed.
 * Thanks for your help !
 *  Plugin Author [Noah Hearle](https://wordpress.org/support/users/designextreme/)
 * (@designextreme)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/shortcode-doesnt-update-with-wp-rocket-cache-enabled/#post-15953420)
 * [@tmnewslang](https://wordpress.org/support/users/tmnewslang/) You can add _admin-
   post.php_ to the exceptions in the WP Rocket settings. I recommend checking support
   relating to this: [Excluding Pages in Page Caching](https://docs.wp-rocket.me/article/54-exclude-pages-from-the-cache).
 * I haven’t found a definitive guide to this, but I do believe this will help you
   get started with a proper long term solution.
 *  Thread Starter [tmnewslang](https://wordpress.org/support/users/tmnewslang/)
 * (@tmnewslang)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/shortcode-doesnt-update-with-wp-rocket-cache-enabled/#post-15953709)
 * Thanks for getting back to me. Admin-post.php should not be cached, only the 
   front end is. I tried adding it to the exceptions of WP-Rocket, but that doesn’t
   work.
 * Just so I know, in order for your plugin to check if the store is opened or not,
   an ajax call is made ? Through which JS file ?
 * It’s not only a simple PHP shortcode executed on page load ?
 * I will need this to get help from WP Rocket I assume.
 *  Plugin Author [Noah Hearle](https://wordpress.org/support/users/designextreme/)
 * (@designextreme)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/shortcode-doesnt-update-with-wp-rocket-cache-enabled/#post-15953777)
 * [@tmnewslang](https://wordpress.org/support/users/tmnewslang/) I recommend continuing
   this with WP Rocket support because your AJAX access and calls should not be 
   cached.
 * Despite the name, the page: _admin-post.php_ is used for both the front-end and
   Dashboard AJAX calls.
 * This plugin uses the standard, well-documented method of submitting/requesting
   data through JavaScript/AJAX. The plugin will accept post data and return new
   data through admin-post.php so it needs to run for the update functionality to
   work.
 * If you find any information from WP Rocket support that will be useful to offer
   as support for others (or even changes to this plugin), please do let me know.
 *  Plugin Author [Noah Hearle](https://wordpress.org/support/users/designextreme/)
 * (@designextreme)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/shortcode-doesnt-update-with-wp-rocket-cache-enabled/#post-15956829)
 * I’m marking this as resolved because _admin-post.php_ is needed for AJAX functionality.
   In this case, another plugin is altering the JavaScript and/or blocking the call
   to this page.

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

The topic ‘[open_now] and [closed_now] don’t update with WP Rocket cache enabled’
is closed to new replies.

 * ![](https://ps.w.org/opening-hours/assets/icon.svg?rev=2706372)
 * [We’re Open!](https://wordpress.org/plugins/opening-hours/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/opening-hours/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/opening-hours/)
 * [Active Topics](https://wordpress.org/support/plugin/opening-hours/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/opening-hours/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/opening-hours/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [Noah Hearle](https://wordpress.org/support/users/designextreme/)
 * Last activity: [3 years, 7 months ago](https://wordpress.org/support/topic/shortcode-doesnt-update-with-wp-rocket-cache-enabled/#post-15956829)
 * Status: resolved