I am using a currency widget to show live currencies for different countries. I also use W3 Total Cache plugin and the widget data is cached. For example yesterday's prices are shown for today and I have to manually purge all caches to get the new data.

Is there anyway to disable cache for certain widgets? or clear the cache every hour for that widget?


You need to use fragment caching so enable PHP in the widget and then use the following tags:

<!-- mfunc --> 

The following links should help:

https://wordpress.org/support/topic/using-shortcodes-with-fragment-caching/ https://www.justinsilver.com/technology/wordpress/w3-total-cache-fragment-caching-wordpress/


The recommended solution is to have your currency widget refresh its data via ajax.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.