Disable Remove Unused CSS for specific pages or posts
In some cases, you may need to disable the Remove Unused CSS feature on a specific page or group of pages. You have 2 options to achieve it:
Using the WP Rocket Options meta box
This is the simplest option when you need to disable it in a few posts.
In the WP Rocket Options meta box, on the Editscreen you can turn off any options of WP Rocket specifically for the page/post you’re currently editing.
Just navigate to that box, uncheck the Remove Unused CSS option, and update your post:
If you need more information on how to turn off additional options on a specific page/post, please read this doc.
Using a helper plugin
If you don't want to do this page by page, going into the editor and unchecking the option there.
Manual code edit required before use!
To install and use the plugin please follow these steps:
- Download the helper plugin zip file, then un-zip it.
- Open the PHP file in a text editor.
-
- If you will exclude posts by IDs, you must edit
line 27
and add post IDs within the array parenthesis - If you won't be adding post ids but URLs, remove any content within the parenthesis on
line 27
. - If you will exclude posts by URLs, you must edit
line 52
and add URLs to be excluded.
- If you will exclude posts by IDs, you must edit
- Re-zip the folder.
- Install the helper plugin on your site - go to Plugins → Add New → Upload plugin and select the zip file.
- Activate the plugin.
📥 Download (.zip): WP Rocket | Disable Remove Unused CSS For Specific Pages or Posts
Developers: You can find the code for this plugin on GitHub.