Need to disable plugins on specific pages in WordPress?
You can do this using a plugin like Asset CleanUp or Perfmatters. By disabling unused plugins, scripts, and styles on specific content types, this means fewer HTTP requests and a faster site.
The most common example is disabling your contact form plugin on your entire site except your contact page. But it doesn’t stop there; you can disable sliders, social sharing, and affiliate link plugins where they aren’t being used. I listed quite a few common examples in this tutorial.
1. Install The Asset CleanUp Plugin
Asset CleanUp is free while Perfmatters is a premium plugin by Kinsta, but Perfmatters has quite a few more speed optimization features than Asset CleanUp. But for the sake of free, I will use Asset CleanUp in the example. It has great reviews, so go ahead and install the plugin.
2. Disable Unused Plugins On Specific Pages
Edit a page or post and scroll down to the Asset CleanUp section.
Another option is to disable a plugin site-wide, and only enable it on certain pages:
3. Use RegEx To Disable Plugins By URL
RegEx (regular expressions) let you enable/disable plugins by URL.
This is only included with the premium version of Asset CleanUp, and Perfmatters.
To disable a plugin on that page, toggle the status to off and you will have 3 options. This examples uses my Review Schema plugin which is only used on all URLs containing the word “review.” In this case, I would use the third option: enable my review plugin on all content containing the word “review” then use RegEx to disable it everywhere else. Just one example.
Disable plugin on current URL:
Disable plugin using RegEx:
Enable plugin using RegEx, and disable it everywhere else:
4. Configure Asset CleanUp Settings
Another way to disable plugins on certain pages and posts is with Perfmatters.
Install the plugin, go to a page or post, and click Script Manager.
Choose to disable the plugin everywhere, on the current URL, or use RegEx:
Perfmatters has other speed optimizations only these (in my opinion) are much more helpful and robust than Asset CleanUp. It can help you limit post revisions, disable autosaves, host Google Analytics locally, disable WordPress heartbeat, and more. It basically takes care of the “last 10% of speed optimization.” Perfmatters was developed by Kinsta, so you know it’s good.
6. Swift Performance
Swift Performance is a cache plugin that also has an plugin organizer.
You can find it in under Settings > Plugin Organizer.
There are tons of rules you can use to selectively disable plugins depending on the URL, whether it’s an Admin page, user role, and AJAX actions (helpful for WooCommerce sites).
7. Plugin Organizer
Plugin Organizer is one of the more popular ways to selectively disable plugins.
Head to settings and there are many options for selective loading plugins on admin pages, mobile, by user, and URL matching. Enable the options depending on what you’re trying to do.
Here’s a screenshot of the “post type” plugin settings to give you an idea of how it works:
Here’s a YouTube tutorial I found for Plugin Organizer:
8. Plugin Load Filter
Plugin Load Filter doesn’t have many reviews, but it’s super simple and does a great job.
Plugin Load Filter supports disabling plugins by post format type, custom post type, JetPack modules filtering, WP embed content, and URL filtering. Just go into the settings and toggle where you want each plugin to be disabled. It also has a few additional settings shown below.
9. Freesoul Deactivate Plugins
Freesoul Deactivate Plugins is another good option.
Just like you would with the other plugins, heading to the settings, select the type of content you want to edit (top tab), then enable or disable plugins on that content by toggling each one.
Here’s a glimpse of the custom URL settings:
Which One Do I Use To Disable Plugins On Pages?
I personally use Perfmatters by Kinsta since it’s very easy to use, comes with RegEx, and it also has tons of other miscellaneous optimizations that aren’t handle by WP Rocket (the cache plugin I use). The only speed plugins I have on my site are WP Rocket, Perfmatters, ShortPixel, and Breeze by Cloudways. Between these, that’s all you need to get 100% GTmetrix scores.
Have a question? Hit me up in the comments.