Clear dynamically content cache when displaying the Menu?
Home › Forums › Pro Support › Clear dynamically content cache when displaying the Menu?
- This topic has 8 replies, 2 voices, and was last updated 5 years, 10 months ago by Iokin Pardo.
-
AuthorPosts
-
June 6, 2018 at 3:50 pm #68164Iokin PardoParticipant
Hi,
I would like to clear some cache of the Container content that at this moment it seems to be cached.
I have a piece of code inside the “Additional Content” section with HTML code and several shortcodes.
Everything seems to be running fine. But once the first user displays the Menu, this code is cached so the second user will see previous user information as it seems to be cached.Is there any way to clear this cache everytime the Menu is displayed? This will avoid displaying other users information.
Thank you very much.
June 6, 2018 at 4:28 pm #68171Peter FeatherstoneParticipantHi there,
I’m afraid that’s not really a question for my plugin but rather for the caching plugins you are using.
My plugin doesn’t do any HTML caching itself so there is nothing to clear from my side.
Please advise
Peter
June 7, 2018 at 3:15 pm #68170Iokin PardoParticipantHi Peter, yes you are completly correct. The cache is due to the W3Total Cache plugin that is enabled.
Now, I would like to know where I should need to add the “Fragment Caching” piece of code in order to avoid caching the Complete Responsive Menu or part of it.<!–mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>
echo ‘The time is ‘.date( ‘H:i:s’, time() );
<!–/mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> –>Thank you very much in advance.
June 7, 2018 at 3:18 pm #68169Peter FeatherstoneParticipantHey Iokin,
Sorry I don’t understand what you mean by
Fragment Caching
, what is that?My plugin is automatically injected into your page so there is nowhere to wrap it in those comments you have above which is what I assume you are trying to do?
You could go down the route of using the shortcode instead and then explicitly including it in your templates at which point you could wrap it in those comments.
That sounds like the only way to achieve that.
Peter
June 7, 2018 at 3:31 pm #68168Iokin PardoParticipantThanks Peter.
Let’s try in a different way, mayybe the question I have done is not the proper one, sorry.
What PHP files are the ones that are called in order to inject the Menu HTML piece on the pages?
Maybe if I exclude them from the caching procedures the Menu content will not be displayed from the cached elements and the Menu will be built every time is called.Thank you very much in advance.
June 7, 2018 at 3:35 pm #68167Peter FeatherstoneParticipantHi Iokin,
There is no PHP file that injects the Menu HTML on the page and if there were you should never edit those directly.
I don’t think what you are asking is possible with W3 Total Cache. I don’t even know how it could half cache a page and ignore other parts. That sounds more inefficient than efficient.
Have you spoken to W3 Total Cache themselves about the possibility of not caching the output of particular plugins?
Please advise
Peter
June 7, 2018 at 3:51 pm #68166Iokin PardoParticipantYes, fragment caching is possible caching half a page (static content) and ignore other parts (dynamic content).
Fragment caching to the rescue:
https://www.justinsilver.com/technology/wordpress/w3-total-cache-fragment-caching-wordpress/In my case, the Menu have static elements like navigation buttons, and a dynamic content inside the “Additional Content” section built with HTML and shortcodes.
Those shortcodes seems to be cached too and this is an issue for our case. So I would like to know exactly where to attack to exclude the caching.
For us is not a problem excluding the complete Menu from the cache.Thanks.
June 7, 2018 at 3:56 pm #68165Peter FeatherstoneParticipantHey Iokin,
So as per my previous reply you will need to use the shortcode, use PHP to echo this in your templates and then wrap that in the
mfunc
comments.I don’t know if that will stop the shortcode in Additional Content from caching as that is a separate thing not controlled by my plugin.
All the best
Peter
-
AuthorPosts
- The topic ‘Clear dynamically content cache when displaying the Menu?’ is closed to new replies.