• Hi there

    I just found out about wordfence::doNotCache() from https://support.wordfence.com/support/articles/1000074182-is-wordfence-and-falcon-caching-engine-compatible-with – brilliant! I was just about to investigate how to use the W3TC fragment cache because I didn’t think Wordfence Falcon could work with WooCommerce or similar systems.

    I need to display the count of items in the user’s cart on every page, so can’t have that section of the page cached. This cart is shown on every page so I can’t simply exclude certain pages from cache – I would need to exclude all pages which obviously results in no cached pages and a waste of time. Based on the details in the URL above, it sounds like wordfence::doNotCache() is exactly what I need. I just don’t understand if it does what I want and how it works from the example shown on that URL. What’s throwing me is that the function is called from within the a href.

    Does calling wordfence::doNotCache() prevent the entire current page from being cached? Or maybe does calling it on any line prevent subsequent code on that particular line from being cached? Is there a particular reason why you have included it in the a href instead of wrapping the whole cart with the code?

    Here’s hoping this does what I want – excludes only a small portion of each page from cache, allowing the rest of the page to be cached.

    Cheers
    Josh

    https://wordpress.org/plugins/wordfence/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Josh,

    Great question! Let me ask our dev team for a complete explanation and I’ll get back to you.

    tim

    Thread Starter digitalblanket

    (@digitalblanket)

    Awesome thanks Tim!

    Thread Starter digitalblanket

    (@digitalblanket)

    Did you get any feedback on this Tim?

    Thanks
    Josh

    Yes. Sorry for taking so long but we’re working on documentation for the product and this was on the list. See here for details:

    http://docs.wordfence.com/en/DoNotCache

    tim

    Thread Starter digitalblanket

    (@digitalblanket)

    Hi Tim

    Thanks for that. What a shame, sounds like the whole page is excluded from cache. That means no pages will ever be cached if the displayed cart is on every page of my site.

    I guess there is no way around this, such as putting the code displaying the cart into a separate php file then included into my template? The doco says it won’t affect an already cached page either, so I can’t even show cached pages to visitors who haven’t added to their cart yet?

    Thanks
    Josh

    I think you can exclude the function too. Thats getting into the weeds a bit but we use it with woocommerce without problems. I think whats its saying is that you can exclude the cart function.

    tim

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

The topic ‘What does wordfence::doNotCache() actually do?’ is closed to new replies.