Enabling, or disabling, a plugin for a specific page only in WordPress

 

This is a scenario that I have encountered more than once when faced with optimising some WordPress installations that had a lot of active plugins and the client didn't want to, or couldn't, do without any of them.

If a plugin is well written it should not load anything on those pages where it is not being used, unfortunately this is not always the case and there is little that can be done to remedy this without resorting to external tools.

One of the best solutions is to use the best paid WPO plugin that exists: Perfmatters. This must-have add-on has a complete and powerful script manager that allows you to create exemption rules for each plugin in different places to prevent CSS and/or JS from being loaded where you don't want it to be.

Even so, it's likely that other requests are still being sent or something is being loaded somewhere else on the blog. So, if we want to make sure to completely stop, i.e. completely disable a plugin from a specific page, Plugin Organizer has just that option, among others. This makes it a very good free tool as an add-on to Perfmatters.

Plugin Organizer also allows you to change the order in which your plugins are loaded. But be warned that reordering or disabling plugins can have catastrophic effects on the page, as it can leave it partially or completely inaccessible if you're not sure what you're doing.

I've used it on a couple of occasions with very good results, so its developer deserves at least a review, although he already has a few that you can find out there.

To exclude a plugin from a specific page you have to make sure that at least the"Selective Plugin Loading" option is activated in the general settings. The rest of the options can be left as shown in this image to start with.

With all plugins active in the"Global plugins" tab, when you open the edition of any post you will find below the editor a box in which checking"Override Post Type settings" will extend the options and you will be able to exclude any of the active plugins only for that post or page.

To understand it better, if a plugin appears in yellow in this box in the editor of a page or post is that it is disabled globally, ie for the entire site and if you mark it from green to red it will be disabled only for that page. In grey will appear the plugins that are installed, but not activated from the WP administration.

To verify that the exemptions are being applied, you will have to visit the site in incognito mode, although you can also configure it to see the changes logged in as administrator.

And that's it. Now all you have to do is draw up your plan for each page or post and you will achieve a significant improvement in the loading speed of these pages and therefore of the site as a whole.

Another of its main functions, no less interesting, is the possibility of ordering the loading of plugins as you want. To do this, just go to"Group And Order" from the menu and drag each one to the position you want. The loading order is set from top to bottom.

Enabling, or disabling, a plugin for a specific page only in WordPress

Here you also have to pay special attention to the behaviour once reordered because depending on the cache plugin you use, and its configuration to minify and/or combine CSS and JS, you can get a favourable result or the opposite.

In any case, the advice is the same as always. The best thing to do is to test it first in a staging environment or prepare a recent backup if you are brave enough to test your site in production and write down all the steps in case you have to go back. Anyway, the plugin has a"Reset to Default Order" option to reset the plugins to their default order.

Although at first it may seem a bit messy, the colour system makes its configuration very intuitive and you can take advantage of it to improve the page loading speed or, at least, not to load it and burden it more if you need to have a lot of plugins installed.

Documentation

Frequently Asked Questions


Suscríbete por email para recibir las viñetas y los artículos completos y sin publicidad

Artículos relacionados

Este blog se aloja en LucusHost

LucusHost, el mejor hosting