Plugin Load Filter: Conditionally Disable or Enable WordPress Plugins on Specific Pages or Posts

Plugins, It’s what makes WordPress so powerful.

You need contact forms, and lots of plugins are available.

Need an eCommerce store for your business? WP has an excellent collection of eCommerce plugins.

Or

Need an affiliate tracking/clock function on your website? Check the WP repository and you’ll find what you’re looking for.

That’s great, But,

If plugins don’t code with best practices in mind, you’ll find they are loading resources on every page and post even if it’s not required.

It’s terrible for WordPress speed and SEO.

But, What if we don’t have to worry about plugins CSS, and JS load on everywhere? And without compromising speed?

The answer is, Plugin Load Filter.

Plugin Load Filter is a free plugin, that gives us the capability to choose and decide to deactivate unnecessary plugins for each individual post and page.

Why do we need to remove/deactivate unnecessary plugins per post/page basis?

As I said earlier, Plugins are what make WordPress powerful.

And, normal WordPress websites have 10 to 20 plugins. Now, some plugins are used for admin dashboards or specific pages or posts.

For example, Contact Form 7.

With five million plus installations, Contact Form 7 is the most famous plugin for creating contact forms.

But,

If you want to use Contact Form 7 on the contact us page only, by design WordPress always loads CF7 CSS/JS on every page of your website.

Now, If one plugin is not necessary on the particular page and takes 50 to 100 milliseconds to load. Imagine if you have 20+ plugins on that page that shouldn’t be there but contribute an extra 1 to 2 seconds in load time.

It makes your website load slower and many times it shows a warning in page speed tools to remove unnecessary CSS and JS from that page. It’s bad for SEO.

Reducing or deactivating the plugins on per page or post basis helps you not only remove that plugin’s CSS and JS, but it also helps you to prevent running PHP logic/program of that plugin on that page. Good for your web hosting account.

Plugin Load Filter – Cut Unnesacary Plugin Fat(Logic/CSS/JS) from Post/Page

Plugin Load Filter(PLF) is a free plugin with 9000+ active installs. It’s a simple and lightweight plugin that helps you to remove plugins for unwanted pages/posts.

It does not help you load CSS or JS conditionally like Perfmatters or Asset CleanUp, It helps you to conditionally load the entire plugin.

I know you can do it with Perfmatters or Asset CleanUp, but that seems out of the scope of this post.

Please note, that Perfmatters is a premium plugin and Asset CleanUp is a freemium plugin (free plugin with premium addon). PLF also has a URL filter addon that’s used for more advanced filtering than the standard feature.

For this post, I am going to use the standard version available in the WP plugin directory. It’s more than enough.

PLF Features:

  1. Support Post Format type
  2. Support Custom Post type
  3. Support Jetpack Modules filtering
  4. Support WP Embed Content card (is_embed template)
  5. Support Simple Post Language Locale switcher

How to use Plugin Load Filter(PLF) to selectively load plugins on your WP website.

Install and Activate PLF on Your Website

If you want to gain complete control over your plugin’s loading behavior, you have to install PLF on your WordPress website.

Go to Plugins > Add Plugins and search for plugin load filter. Install and activate the plugin.

Install and Activate Plugin Load Filter

Access Plugin Load Filter Settings Page

After activation of the plugin, check the left sidebar, you’ll find the Plugin Load Filter tab there. In order to access the PLF setting page, you have to click on that tab.

Access Plugin Load Filter Setting Tab

Configure Plugin Load Filter Settings Page

After clicking on the plugin setting page, you’ll see a simple setting page where all activated plugins are listed. Here you’ll see two different tabs.

  • Filter Registration
  • Page Type Activation

You’ll have to configure the Filter Registration tab first, if you don’t then Page Type Activation is not working.

Plugin Load Filter Setting Page / Filter Registration
  1. You’ll see three types of Page Type Filter here. Choose carefully.
    • Normal – Exclude plugin from Page Type filter
    • Admin Type – If you only use plugins for Admin pages.
    • Page Type – If you want to activate or deactivate plugins for each Page Type and Single page.
  2. Adds a link to the admin bar, you can see which plugin deactivates or activate for the given page.
  3. I never use these post types on my websites, so just tick it or leave it.
  4. If you’re using the multilingual feature on your website, then tick it.
  5. After configuring all settings, save the settings with the Filter Entry button.
  6. After pressing the Filter Entry button, Page Type Activation activates.
    • For activating the Filter Entry tab, you have to choose some plugins Page Filter Type is page type.

Plugin Load Filter Settings – Filter Registration

Plugin Load Filter Setting Page - Filter Registration Tab Setting

I activated three plugins to demonstrate how PLF works.

  1. Normal: plugin load filter
    • Loads everywhere on the website.
  2. Admin Type: Disable Generate Thumbnails
    • Loads only on the admin side of the website.
  3. Page Type: Contact Form 7 and WP Show Posts
    • You can configure how they load on per page/post basis.

Plugin Load Filter Settings – Page Type Activation

Plugin Load Filter Setting Page - Page Type Activation Tab Setting
  1. You have two choices, Desktop, and Mobile. Choose according to your need. I always ✅ activate this.
  2. I want to show Contact Form 7 on the contact us page only and WP Show Posts on a blog post only.
    • If you ✅ tick on these options, that means CF7 loads on every page and WP Show Posts loads on every blog post.
      • I use WP Show Posts used for displaying related posts below content, which means we can activate this option from here. That means it loads on every blog post.
    • For more granular control, don’t activate this option. Control it from the post/page itself.
  3. Click on Activate Plugin Entry to save the option.

How to Control Plugins from Post/Page Editor

On the right side of the post/page editor, you find the PLF setting box. You can enable and disable plugins from here.

Plugin Load Filter Setting Box in Gutenberg Editor, Plugin not activated.
  1. On the Contact page, I add one contact form, with the help of Contact Form 7.
  2. You can enable and disable plugins from this box. You can see currently I am not enabling CF7 to load on this page.
  3. This is a frontend, actual page where you can see CF7 is not able to render the shortcode in actual form.
Plugin Load Filter Setting Box in Gutenberg Editor, Plugin activated.
  1. Now ✅ tick Use and select Contact Form 7 or whatever plugin you want to load on the page. Make sure to tick both mobile and desktop options, or choose according to your need.
  2. Check Contact Form is now displayed on the page instead of shortcode.

Plugin Load Filter Alternatives

PLF is a powerful plugin to control the loading behavior of your plugins, but it is the most basic one. Below I present some alternatives with more controlling options and features.

  1. Perfmatters is a premium WordPress performance plugin, that helps you to disable/enable or control plugins, CSS, JS, or unneeded database calls behavior on per page/post basis. It helps you to remove unused CSS or minify CSS and JS to gain high scores on web vitals tools. You can use it with WP Rocket or Cache Enabler to get the best results. You can also use it with a hosting company that offers packages with server-level caching available, like Kinsta and Rocket.
  2. Asset CleanUp is a freemium WordPress Plugin, it helps you to remove CSS/JS per page basis with lots of other enhancements.

Verdict

Unloading the entire plugin from the page/post is one of the many techniques that are required in the process of making your WordPress website faster.

The plugin load filter is the lightest plugin organizer, that helps you to take full control of your plugin’s visibility on per post/page basis. It helps you in core web vital score and gives you an SEO advantage over your bloated competitors.

You can use it with caching plugins like WP Rocket or free caching plugins like Cache Enabler.

Don’t want to use a caching plugin(I won’t), use it with hosts that offer server-side caching like Kinsta or Rocket. Or use it with your own VPS hosting environment enhanced by Webinoly.

Tell me, which plugins organizer plugin have you experienced on your site?

We want to hear from you, so leave us a quick comment below!

Leave a Comment