Exclude certain block from caching using Fragment Caching – doesn’t work [closed]
IT Nursery
May 17, 2022
0
I have a one form, and I’m inserting it on page footer from a function file. I need to display a random form to each visitors and thus have a function developed to support this. However, with caching enabled the randomness doesn’t work.
I’m using W3 Total Cache Plugin for caching.
So here, I need to exclude certain section of code from caching.
I tried to put the function inside Fragment Caching which should do the trick, but it doesn’t.
We need to pass a random integer from a given array and based on that it loads random form in the footer.
Just
This should print a random number from an array collection given every time a page is refreshed, however due to cache the result. If we disable caching then it works fine, however as you know caching is very important for performance so we can not disable it.
The same code also moved to the footer.php but doesn’t work there as well.
Any idea, how to use fragment caching on function file? I am fine with any other idea that works.
Looking forward to your response.
Thanks
1 Answer 1
From the source:
Here (source) is the mfunc part in the 0.9.2.9 version of the W3TC plugin where the regular expression is: