Use the code PERFMATTERS for 10% off!

How to disable scripts on a per post/page basis (Script Manager)

We now have a Script Manager in the Perfmatters plugin. This allows you to disable scripts on a per post/page basis. This is very powerful and can drastically increase the speed on your WordPress sites (especially your homepage). A few examples of what this can be used for:

  • The popular Contact Form 7 plugin loads itself on every page and post. You can easily disable it everywhere with one click and enable only on your contact page.
  • Social media sharing plugins should only be loaded on your posts. You can easily disable it everywhere and load only on post types, or even custom post types.
  • The Table of contents plugin (TOC) loads on every page and post. With the script manager, you can easily control where you want it loading.
  • If you’ve upgraded to WordPress 5.0 but aren’t using the Gutenberg block editor, perhaps you’re still using the classic editor or another third-party editor, there are two additional front-end scripts that are added site-wide which you can disable: /wp-includes/css/dist/block-library/style.min.css and /wp-includes/css/dist/block-library/theme.min.css.

There are thousands of optimizations you can make with this feature. On some of our sites, we instantly decreased our HTTP requests on our homepage by over 10!


  • Does it work with caching plugins like WP Rocket? Yes.
  • Does it work with plugins like Autoptimize? Yes.
  • Does it work with hosts like Kinsta and WP Engine and server-level caching? Yes.
  • Can you disable entire plugins? Yes, with MU mode you can.
  • Does it disable back-end WordPress admin scripts? No. The script manager works on the front-end of your site.

Enable the Script Manager

To enable it, simply click into the Perfmatters plugin settings and click on the “Extras” tab. Then under “Assets,” enable the Script Manager. Make sure to scroll down and click on “Save Changes.”

Perfmatters Script Manager
Enable the Perfmatters Script Manager

Using the Script Manager

After you enable the Script Manager you will need to browse to a page or post on your site (it won’t appear in the main WordPress admin dashboard or from the plugin settings page). It will then show in the toolbar of your site.  We recommend browsing to your homepage and starting there.

Access scripts manager
Access the Scripts Manager

If you have your admin bar hidden for any reason on your WordPress site, you can also access the script manager by appending ?perfmatters onto the end of your URL. For example:

Script Manager

After clicking on “Script Manager” in your toolbar you will be presented with all the scripts, both JavaScript and CSS files, that are loading on that page or post. You have the following options:

  1. Status On (default setting)
  2. Status Off: Disable Everywhere (you can then choose which posts types you want it enabled on, along with the current URL)
  3. Status Off: Disable only on current URL (this is very useful for using on your homepage)
  4. Status Off: Exceptions (current URL or by post type)
Perfmatters script manager
Perfmatters script manager

Everything is grouped together by the plugin or theme name. This makes it super easy to disable an entire plugin at once. Typically a WordPress plugin will have both a JavaScript and CSS file. A WordPress theme might have 10+ files. You can even disable scripts with regex.

After you select and or modify the settings, make sure to hit “Save” at the bottom. You can then test in Pingdom or a website speed tool to ensure the scripts are no longer loading on the page or post. Make sure to clear your cache first! And if anything goes wrong on your site visually, you can always re-enable it in the settings to return to normal.

Global view

The “Global View” is a visual representation of the Script Manager configuration across your entire site.

Perfmatters global view
Perfmatters global view


In the Perfmatters settings page, you can do the following:

  • Hide the disclaimer message box which shows across all Script Manager views.
  • Add WordPress archives to your Script Manager selection options. Archive posts will no longer be grouped by their post type.
  • You can also reset the script manager settings across the entire plugin.
Perfmatters script manager settings
Perfmatters script manager settings

Can you disable external scripts?

We get asked this question a lot, and the answer is yes! You can disable external scripts, however, they must be enqueued properly in WordPress. So this depends on the implementation of the external script on your site.

Can you disable queries and inline CSS/JS?

Yes, you can disable queries and inline CSS/JS with the Script Manager’s MU mode.

Current ID Filter

We do our best to determine the ID of the current page/post that is being loaded for the Script Manager to assign settings to. In some cases, you may want to add some additional logic of your own depending on the configuration of your site to ensure that the Script Manager is grabbing the correct ID for all of your posts.

You can use the perfmatters_get_current_ID filter to modify and return a different value based on whatever you want. Here is a basic example.

function perfmatters_filter_current_ID($currentID) {

     $currentID = 123;

     return $currentID;
add_filter('perfmatters_get_current_ID', 'perfmatters_filter_current_ID');

Testing disables

We always recommend first testing on a staging or development site if possible. With that being said, the great thing about the Script Manager is that it doesn’t make any permanent changes. So you can easily disable scripts one by one, and check your site as you go. If there is a problem, you can simply revert the last change you made.

Another alternative would be to use Chrome DevTools. In the network panel, you can select “Block request URL” on a script to see how it would impact your site. You can then apply the change in the Script Manager. Just make sure to unblock it in Chrome DevTools after you’re done.

Block request URL


Below are a few troubleshooting tips.

Can’t see a script or asset

Can’t see a particular script or asset in the Script Manager? Here are a couple of reasons why that might happen:

  • The script hasn’t been properly enqueued to WordPress by the plugin or theme developer.
  • It’s using a hardcoded font-face declaration (@font-face) within a CSS file.

“Settings failed to update” error when saving

If you are trying to save your settings in the Script Manager and get the “Settings failed to update” error, it could be due to the following:

  • Make sure to select an option underneath Disabled, such as Everywhere, Current URL, Regex, etc. You can’t disable a script or plugin without selecting where you want to disable it. Note: We are going to updating this to a more user-friendly warning soon.
  • It could be that a plugin or your theme is conflicting. This is rare, but sometimes developers create tools to style inputs globally and they don’t put any stops in for other plugins that need to use input fields.
  • Another issue could be a cascading JavaScript error from something else. This is also rare, but if you look in Chrome DevTools console, you might be able to spot the source for this.
Chrome DevTools console error

If you are encountering any issues with the Script Manager, please contact us. We are always happy to help.

Was this article helpful?

Related Articles