Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

How to remove fragment cache

Envira Gallery utilizes caching mechanisms to enhance performance by speeding up the loading times of your image galleries. However, there may be cases where you wish to disable fragment caching—for instance, when you’re experiencing issues with dynamic content not updating or displaying correctly.

This tutorial will guide you through the process of removing fragment cache from your Envira Gallery setup.

Heads up!

This guide includes PHP code customization to alter the default caching behavior of Envira Gallery. While the code is provided as a courtesy, we do not offer support for customizations or third-party development.

Adding the Code Snippet

To disable fragment caching in Envira Gallery, you’ll need to add a couple of filters to your WordPress site. Follow the instructions in this document to safely add PHP code.

Here’s the code snippet you’ll use:

/* Envira - Envira - Remove Fragment Cache
* 
* @link https://enviragallery.com/docs/how-to-remove-fragment-cache-from-envira/
*/

add_filter( \'envira_gallery_get_transient_markup\', \'__return_false\' );
add_filter( \'envira_gallery_should_cache\', \'__return_false\' );

By removing fragment cache from Envira Gallery, you can ensure that your galleries remain dynamic and reflect real-time changes without any caching-induced delays or discrepancies. While this may have an impact on performance, it guarantees that users always see the most up-to-date content.

That’s it! Would you like to extend Envira further? Check out our tutorial on how to Display Adsense Ads in Lightbox.