Custom Post Update does not clear caching

Cache is not getting clear when post is updated. It is happening for a custom post type acrhive in my site. If you update the post's title and go to the page where the posts are loading I can still see the old titles.
I have the "Clear full cache when post/page is updated" option enabled. The data on the page is generated from a form submission is used to display content on that page. It works if I go to individual custom posts and clear cache. But the clear cache button on dashboard does not work. I have even disabled the cache query URL.

  • Dimitris
    • Support Star

    Hello there Susan,
    hope you're doing well today! :slight_smile:

    I tried to replicate this in a testing site of mine, but after changing a property title, I was able to see the new title in both the single property view, as well as in the custom search results page that WP-Property plugin provides. That needed only a tab refresh, didn't have to manually clear page caching, as I had set it to clear automatically, just like it's set in your website now.

    I'd also like to add that the search results page shouldn't be cached statically by HummingBird at all, unless you have enabled the HummingBird Pro -> Caching -> Page Caching -> Cache URL queries option, where "you can turn on caching pages with GET parameters (?x=y at the end of a url), though generally this isn’t a good idea if those pages are dynamic.".

    I can now see that the reported property and search results page that you shared during the live chat are showing the same information. Did you clear caches in order to get this? Or did you make any other change in HummingBird Page Caching settings? Please advise!

    Thank you,
    Dimitris

  • Susan
    • Stand Out

    Hello,

    The details on property post type is updated through cron job every night. I have not done any changes in hummingbird settings as you were about to check the issue.

    To achieve the result, I have cleared cache of individual property and that showed me correct details of property on frontend.

    Can you please let me know what to do in order to clear cache when property is updated through cron job, programmatically.

    Thank you!

  • Susan
    • Stand Out

    Please let me know that is there any hook for clearing cache like there is for generating report?

    Hook : wphb_performance_report
    Action : WP_Hummingbird_Module_Reporting_Cron->process_report()

    I need hook to clear cache for custom post type named property.

  • Nebu John
    • Staff

    Hi Susan,

    Hope you are doing good today.

    Fortunately, Hummingbird includes a simple API that can be used to trigger cache. There'd be two ways of doing this. One is using an action hook "wphb_clear_page_cache" and the other one is to use REST API.

    The first method is pretty easy to use, all you'd need to do would be to execute that action in your cron job programmed in WordPress whenever you want to clear the cache.

    do_action( ‘wphb_clear_page_cache’);

    Hope this helps you.

    Kind Regards,
    Nebu John

  • Pawel
    • Staff

    Hello Susan!

    Hope you're having a good day today!

    I'm not sure if I'm getting this right, but since you mentioned Browser caching, that's a different issue.

    When it comes to browser caching, that's a completely different functionality from page caching.

    Page caching stores pre-processed pages as files on disk to serve them without the need to run PHP again and parse the code.

    Browser caching works by storing files in the cache on visitor's browser to avoid having to download the same unchanged files over and over again.

    Clearing the Page Cache will not make the browser cache to be updated without additional action from the visitor (doing a force-refresh, like Cmd+Shift+R in Chrome on macOS will force to clear the cache and download the files again).

    Browser cache works by adding an Expires header to each response from the server for each file. Browsers note this header and will not try to download the file again until the date mentioned in the header passes, unless someone does a force-refresh.

    But in your case, the browser caching should not apply, since the HTML pages on our servers don't have an Expires header. We only use that for assets like CSS, JS and media files. So I think, that's still page caching.

    I wasn't able to find the code you used to trigger the action. Can you please share the code or point us to the place where it is located?

    Kind regards,
    Pawel

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.