Can I exclude a shortcode from the cache?
It's not possible to exclude the output of a shortcode from being cached. That would require fragment caching which WP Rocket doesn't support.
Page caching caches the entire output of the page. If your shortcode requires PHP to update its contents, it will not work with caching. The content will only be updated each time the cache is cleared.
Solutions / workarounds
- If the content is only displayed on a couple of pages, those pages could be excluded from the cache.
- In WP Rocket the only possibility is to reduce the Cache Lifespan (on the Cache tab) to a lower value. This won't be perfect since the cache will only refresh at that specified interval, but the content will be less out-of-date.