Have you ever wondered how WordPress plugins affect the loading time of your site? The WordPress plugins allow you to add functionality to your site, but they can also affect the speed of a website. In this tutorial, we will show you how to WordPress plugins affect the loading time of your site, and how you can control them more effectively.

Modify the loading time of a plugin 1

How does a plugin work?

WordPress plugins is similar to an application for your WordPress site. You can install them to add more features to your site like contact forms, photo galleries, or an ecommerce store.

When someone visits your website, WordPress first loads its core files and then loads all of your active plugins.

How can plugins affect your blog?

Each WordPress Plugin offers different features. To do this, some plugins make calls to the database in the background while others load files on the front-end such as CSS, JavaScript files, etc.

Most plugins make an HTTP request to load files like scripts, CSS and images. Each request increases the loading time of the complete page of your site.

Once done correctly, the impact on performance is often too noticeable.

Therefore, if you use multiple plugins that make too many http requests to upload files, it will affect your site performance and user experience.

How to check the files loaded by WordPress plugins?

To see how plugins affect your page loading time, you need to check the files loaded by these plugins on WordPress.

There are a lot of tools you can use to figure this out.

You can use your browser development tool (in Google Chrome "Inspect item").

Just visit your site and right click to select " Inspect ". This will open the development tools panel.

You need to click on the "Network" tab and then reload your website. To see how it loads, and to see all the files it loads.

Network development tool

You can also use third-party tools like Pingdom and GTmetrix to see this. These tools will also allow you to see all the files that are loaded and how long they take to load.

Pingdom tool

How many plugins do you need to install?

If you see these different files loaded, you can start wondering how many plugin plugins you need to use?

The answer really depends on the set of plugins you use on your website.

A single bad plugin can load 12 files while several good plugins just add a few extra files.

All well-coded plugins try to keep the files they upload to a minimum. However, not all plugin developers are careful. Some plugins load files on every page, even when they don't need that file.

If you use a lot of these plugins, it will start to affect the performance of your site.

How to keep plugins under control?

The most important thing you can do on your WordPress site is to only use plugins that are well coded, have good reviews, and are recommended by trusted sources.

If you find a WordPress Plugin affects how your site loads, so look for a better plugin that does the same job, but better.

Then you need to start using caching and CDN to further improve the performance and speed of your site.

Another factor that you should consider is the hosting of your website. If your hosting servers are not properly optimized, it will not increase your site's response time.

This means that not only the plugins but the overall performance of your site will be slower. Make sure you are using one of the best WordPress hosting.

As a last resort, you can uninstall plugins that you don't use. Carefully examine the plugins installed on your site, and see if you can uninstall them. This is not an ideal solution, as you will have to compromise functionality against the speed of your blog.

Disable stylesheets plugins on WordPress

First, you need to find the name or handle of the stylesheet that you want to unregister. You can locate it using your tool " inspect element ».

Browser element inspection

After finding the style sheet handle, you can ' unregister By adding this code to the file functions.php Of your theme or the main file of a plugin.

add_action ('wp_print_styles', 'my_deregister_styles', 100); function my_deregister_styles () {wp_deregister_style ('gdwpm_styles-css'); }

You can “unregister” as many style handles as you want in this function. For example, if you have more than one plugin whose stylesheet you want to "unregister" then you can do it like this:

add_action ('wp_print_styles', 'my_deregister_styles', 100); function my_deregister_styles () {wp_deregister_style ('gdwpm_styles-css'); wp_deregister_style ('bfa-font-awesome-css'); wp_deregister_style ('some-other-stylesheet-handle'); }

Remember, 'unregistering' these stylesheets will affect the functionality of plugins on your site. You must copy the contents of each style sheet you delete and paste them into your style sheet. WordPress theme or add them as custom CSS.

Disable javascript plugins

Just like style sheets, you will need to find the handle used by JavaScript files to "unregister" them. However, you will not find the handle using the " Inspect ».

For this you will need to dig deeper into the plugin files to find the handle used by the plugin to load a script.

Another way to find out about all the handles used by plugins is to add this code to your theme's functions.php file.

function bpc_display_pluginhandles () {$ wp_scripts = wp_scripts (); $ handlename. = " "; foreach ($ wp_scripts-> queue as $ handle): $ handlename. = ' '. $ handle. ' '; endforeach; $ handlename. = " "; return $ handlename;} add_shortcode ('pluginhandles', 'bpc_display_pluginhandles');

After adding this code, you can use the [pluginhandles] shortcode to display a list of plugin script handles.

Handles wordpress scripts

Now that you have script handles, you can easily "unregister" them using the code below:

add_action ('wp_print_scripts', 'my_deregister_javascript', 100); function my_deregister_javascript () {wp_deregister_script ('contact-form-7'); }

You can also use this code to disable multiple scripts, like this:

add_action ('wp_print_scripts', 'my_deregister_javascript', 100); function my_deregister_javascript () {wp_deregister_script ('contact-form-7'); wp_deregister_script ('gdwpm_lightbox-script'); wp_deregister_script ('another-plugin-script'); }

Now, as we mentioned earlier, disabling these scripts will prevent your plugins to function properly.

To avoid this, you will need to combine the JavaScripts codes together, but sometimes it does not work properly, you need to know what you are doing.

That's all for this tutorial, I hope you'll know how to improve your plugins. If you have any questions, feel free to ask them.