Support » Plugin: We’re Open! » [open_now] and [closed_now] don’t update with WP Rocket cache enabled

  • Resolved tmnewslang

    (@tmnewslang)


    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 5 months, 1 week ago by tmnewslang.
    • This topic was modified 5 months, 1 week ago by tmnewslang.
    • This topic was modified 5 months, 1 week ago by tmnewslang.
    • This topic was modified 5 months, 1 week ago by tmnewslang.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Design Extreme

    (@designextreme)

    @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 Design Extreme

    (@designextreme)

    @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

    (@tmnewslang)

    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 Design Extreme

    (@designextreme)

    @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 Design Extreme

    (@designextreme)

    @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

    (@tmnewslang)

    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 Design Extreme

    (@designextreme)

    @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.

    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

    (@tmnewslang)

    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 Design Extreme

    (@designextreme)

    @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 Design Extreme

    (@designextreme)

    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)
  • You must be logged in to reply to this topic.