What does wordfence::doNotCache() actually do?
-
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
The topic ‘What does wordfence::doNotCache() actually do?’ is closed to new replies.