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 and Perfmatters are two popular ways to selectively disable plugins.
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.
Now you’ll see all plugins running on the page, as well as CSS and JavaScript files from WordPress theme, core, and third party scripts. You can unload each of them on the individual page, site-wide, by post type, or using regular expressions. Note: RegEx is only included with Asset CleanUp premium and Perfmatters. There are also options for preload, async, and defer.
Most plugins have multiple CSS + JavaScript files loaded on the page. To disable them all at once, select the “Check All” option and Asset CleanUp will unload all elements for that plugin.
Another option is to disable a plugin site-wide, and only enable it on certain pages:
[…]
This article was written by Tom Dupuis and originally published on Tom Dupuis.