WP Rocket is one of the most popular caching plugins available for WordPress. It broke the traditional rule of having hundreds of options and offers simple easy to use interface for users. You can simply toggle the options to speed up your site in matter of few minutes. However, the plugin does not offer any option in the frontend to disable page caching or bypass the setup for specific pages. In this article, we will explain how to bypass WP Rocket caching in WordPress using various methods.
Bypass WP Rocket Caching
Though caching helps users to load the pages quickly, it may create problems when you do certain activities. Below are some of the common scenarios you may want to bypass WP Rocket caching:
- You want to test the page speed score in Google PageSpeed Insights tool with and without WP Rocket plugin. You may also want to see how many CSS or JS files are loaded without caching or do similar analysis.
- Only want to disable WP Rocket caching on certain pages. For example, WP Rocket will not work with WooCommerce and GeneratePress theme and make the shop pages non-responsive. You need to disable WooCommerce styles on small screen to overcome this issue
- You want to disable page level caching which is automatic with WP Rocket without any option to disable it in the frontend.
Depending upon on the situation, you can follow one of the following options to bypass WP Rocket caching. In most cases, you may need to disable the plugin on entire site or page level instead of bypassing. Therefore, we will explain the available options for disabling as well as bypassing without deactivating.
1. Disable the Plugin Completely
The simple and easy option is to simply deactivate the plugin on your site. You can finish the testing and then reactivate again. Good part is that the plugin will retain all your previous settings. However, it is not a feasible solution to completely disable the plugin every time when you want to test something simple.
Remember, you should deactivate the plugin when you want to test the compatibility or want to test another caching plugin. For example, if you want to test W3 Total Cache then first deactivate WP Rocket even before installing W3 Total Cache plugin. These caching plugins will add drop-in plugin files like advanced-cache.php which may conflict with each other when both plugins are active. As a result, your site will show white screen of death or the caching will not work.
Go to “Plugins” section in your WordPress admin panel and click “Deactivate” link under the WP Rocket plugin. Click “Skip & Deactivate” button to temporarily deactivate the plugin without deleting the cached content.
2. Disable the Plugin on Particular Pages
Most WordPress commercial themes offer page builder integration like Elementor and Visual Composer. Caching will have real problems when using heavy JavaScript on your pages with page builder plugins. Elements like dynamically animated charts and jQuery data tables may not work as expected with aggressive caching plugins like WP Rocket. The best solution is to disable WP Rocket caching on the pages where you have problem with caching.
- Go to “Posts” or “Pages” and find your article and edit in Gutenberg editor.
- WP Rocket will add a meta box in the editor that you can use to change the global behavior. If you do not see the meta box in the sidebar, click on the three dots button and select “Preferences”. Go to “Panels” section and enable “WP Rocket Options” meta box.
- Once you see the meta box in the sidebar, check the box against “Never cache this page” option.
- Publish your article and the plugin will ignore the page from all types of caching.
You can also do the same procedure for any other custom post types on your site.
3. Purging Cache for Specific Pages
Similar to excluding pages, you may also want to simply delete the cache on certain pages. By default, WP Rocket will purge the cache whenever you change the content of the page and publish again. However, purging may not work in some cases like when you change the category from post index page or change the content outside the editor with third-party tools. In any case, we recommend purging the cache for that specific page before you share the URL or submit in Google Search Console.
- Go to “Posts” section and find the page you want to delete the old cache.
- Hove over the title link and click on “Clear this cache” option.
- This will delete the old cache and WP Rocket will cache the new content when the page is visited again.
4. Exclude Pages from Caching
If you do not want to exclude the pages by going to editor, you can also exclude from the plugin’s settings. The advantage of using settings is that you can use different options like regex or restrict particular user agents from accessing cached pages. You can ignore caching of pages by going to “Settings > WP Rocket” menu and navigate to “Advanced Rules” section.
On the same settings page, you can add user agents under “Never Cache User Agent(s)” section.
5. Bypass WP Rocket Caching without Deactivation
Sometimes, you want to test multiple pages bypassing the cache and without deactivating the plugin.
- Simply add ?nowprocket parameter with the page URL you want to test access uncached page bypassing WP Rocket caching.
- For example, if your page URL is “https://yoursite.com/my-page/” then use the URL like “https://yoursite.com/my-page?nowprocket” for accessing uncached page’s content.
This is the best way to check your page speed by bypassing WP Rocket caching and do compatibility testing. However, this will not bypass the caching rules applied through htaccess file. For example, WP Rocket will apply htaccess directives for browser caching and GZIP compression which may still work when bypassing with ?nowprocket query.
6. Disable Page Level Caching
The last option is to permanently disable page level caching on entire site or on specific pages. This is not advisable as page caching is important to improve the speed. However, you may need this in some cases where you have another plugin for page caching which conflicts with WP Rocket setup. For example, SiteGround offers automatic static caching caching (plus browser caching and GZIP compression) with the Nginx direct delivery option from hosting account. We have confirmed with WP Rocket support team that WP Rocket on SiteGround setup works without any conflicts.
However, this may not work on all custom caching setup and the solution is to disable page caching from WP Rocket as you can’t change the hosting setup quickly. Unfortunately, this is a lengthy process and you need different helper plugins depending upon your requirement.
6.1. Enable Page Caching for specific URLs
Follow the below step to enable WP Rocket page caching only for specific pages on your site.
- Go to GitHub and download WP Rocket helper plugin for page caching with exclusions.
- Unzip the archive file and edit the “wp-rocket-no-cache-with-exception-urls.php” file.
- They have included three sample inclusion URLs from line 24 to 27 in that file as below. You can replace the “example.com/page-one/” and other two example lines with your domain’s URL. If required you can add more lines between that block.
- Save the file and archive it as ZIP folder again along with readme file.
- Go to your WordPress admin panel, upload the plugin and activate like any other plugins on your site.
Now that WP Rocket will not do page caching on entire site except that the URLs listed in the helper plugin’s file.
6.2. Disable Page Caching Only on Specific Pages
Instead of the above way, you can use an alternate helper plugin to disable page caching only on certain pages.
- You can download the helper plugin and edit the “wp-rocket-no-cache-for-page.php” file.
- In this case, you have to enter the post or page IDs in line 29 by replacing the sample IDs 1, 2 in the file.
- Save the file and zip it again to upload in your site.
- Activate the plugin to disable page caching only on the provided post or page IDs.
6.3. Disable Page Caching Completely
If you want to disable page caching on the entire site without exception, then use this helper plugin. You can simply upload and activate it on your site without modifying the plugin’s file content.
6.4. Disable Page Caching for Logged in Users
Both the above methods are disabling page caching for normal users not logged into your site. However, WP Rocket also offers a feature to create separate cache for logged in users. You can enable this option under “Cache > User Caching” section.
If you want to disable page caching for logged in users, then use this helper plugin. You need not to modify the content, simply upload the zip file and activate the helper plugin. Remember, you need to use this plugin along with one of the above methods to disable page caching for both logged in and logged out users.
Points to Remember
Generally, WP Rocket will purge the cache whenever there is a change on your site. However, we recommend you deleting the following cached content before you try to test the pages again.
- Delete your browser’s cache by pressing “Control + Shift + Delete” in Windows and “Command + Shift + Delete” in macOS. This will open the delete browsing history pop-up from where you can delete previously cached files from your browser. However, this will log you out of from WordPress admin panel as the session cookie will expire. Therefore, first save all your changes and log out before clearing browser’s cache. The best option is to use alternate browser for testing purpose so that you can test in parallel without logging out.
- Delete caching from any other plugins if active on your site. As mentioned, all SiteGround sites come with preinstalled SG Optimizer plugin. Hence, you need to purge SG Optimizer caching before doing testing.
- Finally, purge server level caching if active on your hosting server. This is the case with most hosting companies that offer varnish or custom caching setup.
Final Words
As you see, bypassing WP Rocket caching in WordPress site is a simple task by adding a parameter to your URL. You can also exclude individual pages from the plugin’s global settings or from the editor meta box. However, disabling page caching completely or on specific pages is a tricky task that needs a helper plugin. Make sure to choose the correct method based on your need to get correct results.
Leave a Reply
Your email is safe with us.