We now have a Scripts 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 scripts 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:
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.
Enable Scripts Manager
To enable it, simply click into the perfmatters plugin settings and click on the “Extras” tab. Then enable the Scripts Manager.
Using the Scripts Manager
After you enable the Scripts Manager you will need to browse to a page or post on your site (it won’t appear in the main WordPress admin dashboard), and it will then show in the toolbar of your site. We recommend browsing to your homepage and starting there.
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:
- Status On (default setting)
- Status Off: Disable Everywhere (you can then choose which posts types you want it enabled on, along with the current URL)
- Status Off: Disable only on current URL (this is very useful for using on your homepage)
- Status Off: Exceptions (current URL or by post type)
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.
The “Global View” is a visual representation of the Script Manager configuration across your entire site.
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.
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.