1

I am developing a plugin and I don't want the output of my shortcode to be cached by popular WordPress caching plugins like W3Ttoalcahe, WPSuperCache, etc. Is there any way I can achieve that or ask my users to configure their caching plugins so that my shortcodes are rendered dynamically and its output is not cached?

0

I don’t think that there is a way to do this. All that shortcode does is generating some HTML code and putting it as content.

But... there is a workaround you can use. Your shortcode can generate only a placeholder for its content and then you can use AJAX to populate it with real content. It’s a pretty common practice to deal with cache in WP - for example WooCommerce uses exactly this method for its cart.

PS. If you’re using W3TC you can set a list of pages that shouldn’t be served from cache.

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.