Filter the execution of plugins to speed up WordPress

WordPress plugins are important development resources for the popular content management system (CMS). Through the plugins you can add modules and functions, without being WordPress developers . However, not everyone knows that plugins can significantly reduce site performance by slowing it down considerably. If the plugins are not developed and tested correctly, they can dramatically increase the execution time of the scripts and slow down the loading of the pages.  We explains how to speed up WordPress, filtering plugins and choosing which page of the site to activate them, blocking them in all the others.

When WordPress Plugins can slow down the site

Before installing a WordPress plugin, it would be useful to test it locally and evaluate the impact on site performance. A new plugin is a new piece of additional code, which could also involve security issues and therefore requires maximum attention. The most emblematic example of plugins to be installed with caution is represented by Contact Form 7, the very popular Plugin for inserting contact forms on WordPress. This plugin, which works very well, includes two resources in all the pages of the site, even if there is no contact form on the page. The offending resources are script.js and style.css. The unconditional loading of these elements involves the useless waste of WordPress resources and the consequent slowing of the performances. Fortunately there is a solution for this problem, increasing a system that allows you to enable or disable the plugin based on certain conditions and individual pages.

Speed ​​up WordPress with Plugins

There are two ways to disable a WordPress plugin based on the page; the first method is to manually create a PHP script,  saving it in the folder of the Must-use-plugin of WordPress.

The Must-use-plugin of WordPress are atypical plugins, which are executed before the traditional plugins and can not be visible or managed by the WordPress bulletin board. The only way to create a Must-use-plugin is to place them manually within the default / Site / mu-plugins / directory.

The second solution, much simpler, is to install a plugin that allows filtering the selective execution of all the other plugins. Plugin Load Filter is the complete solution to activate or deactivate plugins, based on certain criteria. Once the plugin is installed, it will be possible to call up the configuration page, by positioning itself in the menu sidebar, on Plugin> Plugin Load Filter. The first menu screen allows you to select the plugins to deactivate. For each plugin you can assign three values: Norman Load ( default ), Admin Filter and Page Filter. The first option indicates that the corresponding plugin will always be active, unconditionally, on all pages. Assigning to a plugin the Admin filter option, means to tell WordPress that that specific element will have to work only when you log in with an administrative use of WordPress. The last option, the most intriguing and functional, allows you to assign different activation and deactivation criteria for plugins. The exceptions provided by the Page Filter function, allow for example to activate a WordPress plugin only in the desktop version of the site and deactivate it in the mobile version (and vice versa), to select only some pages in which the plugin will work, and much more.

How to measure the speed of WordPress

Clearly, the procedure described represents only a part of the operations to be carried out to optimize a WordPress site , with a view to performance and SEO . We plans to publish other WordPress guides dedicated to SEO and more technical aspects of the platform. Now that you have learned how to filter plugins, try to test site performance using one of the services listed below.

The  tools to measure the speed of WordPress

On the net there are different tools to measure the performance of a website ; some of them are really valid and allow us to test the WordPress site (but not only), to avoid penalties or malfunctions. A fast and functional website is always a step forward compared to a slower and more problematic one. Here are three tools you can use to test your site:

Pingdom.com  is a completely free tool that allows you to measure the loading of pages and integrated elements (images, CSS, JavaScript) creating final reports that are easy to read for all users. The paid version, allows you to plan automatic analysis of the site, generating alerts in case of reduced performance.

PageSpeed ​​Insights  is a performance tracking tool for a site that uses Google’s evaluation criteria. Through this tool you can check the performance of a site in the mobile or traditional version. PageSpeed ​​Insights generates detailed final reports, with an overall rating of 1 to 100 and advice on parts of the site to be optimized.

GTmetrix  is a very useful and functional tool for measuring the performance of a site. It allows to compare sites, offers detailed reports, exportable on the PC. It is a valid and functional tool for everyone. Like Pingdom, even GTmetrix in the paid version allows you to perform automatic scans and be alerted in case of performance problems of your site.