How To Disable Cache In Wp Rocket

WP Rocket is a popular caching plugin for WordPress that helps improve website performance by storing static files and serving them directly from the server. However, there may be instances where you need to disable cache in WP Rocket for certain pages or posts.

Why Disable Cache in WP Rocket?

There are several reasons why you might want to disable cache in WP Rocket. For example, if you’re making changes to a page or post and need to see the updates immediately, disabling cache can help prevent any delays caused by cached files.

How to Disable Cache for Specific Pages or Posts

To disable cache for specific pages or posts in WP Rocket, you’ll need to add a custom code snippet to the page or post. Here are the steps to do so:

  1. Open the page or post you want to disable cache for in your WordPress dashboard.
  2. Click on the “Text” tab in the editor toolbar.
  3. Add the following code snippet to the top of the page or post:
  4. add_filter( 'rocket_cache_reject_uri', '__return_true' );
  5. Save your changes and publish the page or post.

How to Disable Cache for All Pages or Posts

If you want to disable cache for all pages or posts on your website, you can do so by adding a custom code snippet to your theme’s functions.php file. Here are the steps to do so:

  1. Open your theme’s functions.php file in a text editor.
  2. Add the following code snippet to the top of the file:
  3. add_filter( 'rocket_cache_reject_uri', '__return_true' );
  4. Save your changes and upload the updated functions.php file to your server.

Conclusion

Disabling cache in WP Rocket can be a useful tool for troubleshooting issues or making quick updates to your website. By following these steps, you can easily disable cache for specific pages or posts or for all pages on your site.