WordPress Plugin : Plugin Load Filter

日本語ページへ

WordPress slows down when you use a lot of plugins.

One reason for this is that all currently enabled plugins are loaded, and some pages are loaded with unwanted plugins.

This plugin allows you to speed up the response time by filtering to only load the plugins you need for that page.

Plugin Load Filter

Feature

It’s not uncommon to see 10 or more plugins in use, and there are a surprising number of plugins that are only used for certain pages or admin dashboard pages!

For example, if you are using Contact Form7.

Even if you want to use Contact Form7 only on the contact page, WordPress will always load the Contact Form7 plugin.

If the plugins are always loaded, and if one plugin takes 50 milliseconds to load, then 20 plugins will take 1 second to load.

This is the reason why plugins can get heavy when used too much.

It’s a shame to load a backend plugin such as TinyMCE Advanced, which is used for writing articles, into a frontend page request.

Reducing the loading of plugins means not only the PHP program of the plugin, but also the related CSS, JS, translation files, etc. will not be loaded at the same time!

Also, if you offer some kind of web service in WordPress other than blogging, you can use different plugins for different types of blogs and web services, for example.

Install

Download

You can download it from the official website!

Plugin Load Filter
Dynamically activate the selected plugins for each page. Response will be faster by filtering plugins.

You can install the downloaded zip file by uploading the plugin on Plugins pageAdd New.

Alternatively, you can search for and install plugin load filter in PlugIns – Add New.

Required Environment

  • WordPress 5.3 or higher
  • PHP version 7.2 or higher.

When activated, this plugin automatically places a plf-filter.php file in wp-content/mu-plugins folder and makes it work as a required plugin.

Permission to create the mu-plugins folder and files is required.

Usage

Configure it from the menu Plugin Load Filter that has been added to the admin dashboard.

  1. Setting the Page Type Filter in Filter Registration
  2. Register a plugin for Pege Type Activation to activate for each Page Type
  3. If you want to filter on single page, you can activate plugins from the page’s edit screen
  4. View the page while logged-in and check the filtered results from the link in Admin-bar

Repeat this procedure to set up and check the operation.

It may be a bit of a hassle to set up, but if you can get it right, you can reduce plugin loading and speed up the page display, so please give it a try!

Filter Registration

  • Select the filter target from activated plugins, Jetpack enabled modules, etc.
  • Page Type filter exclusion plugins (Normal) will be loaded as usual
  • Even plugins set to Page Type Filter are loaded in requests to Admin dashboard, Rest API, admin-ajax, wp-cron, etc.

Plugin filtering for Admin dashboard, Rest API, and Ajax requests is supported by URL filter Addon (sold separately).

Page Type Filter

Page Type Filter is for registering plugins that you know will only be used on specific pages and specifying the conditions under which they are activated for each Device and Page Type with Page Type Activation.

There are two types of Page Type Filter that can be set to one of those types. Plugins with a filter type set will be dynamically active or deactivated.

  1. [Admin Type] : If you only use plugins for Admin dashboard pages.
  2. [Page Type] : If you want to activate or deactivate plugins for each Page Type and Single page.

You don’t need to filter plugins that are not known to work. If you’re not sure whether to filter, we recommend that you leave the plugin as Normal.

If you’re filtering a lot of plugins, notice the value of max_input_vars in php.ini. The value of this setting (default 1000) cannot be exceeded.

There was a report on Forums that when trying to filter more than 32 plugins, the configuration data could not be updated, and this was resolved by increasing the value of max_input_vars
Issue when setting many plugins to “page type”

Page Type Activation

Plugins registered to Page Type Filter will be blocked once, so you can select the conditions to be activated for each plugin, such as Device, Page Type, Custom Post Type, etc. to make it work.

  1. Device selection (desktop, mobile)
  2. Selecting Page Type, Post Format or Custom Post Type, etc.
  • Please make sure you don’t miss a plugin activation setting for Page Type, Post Format, etc.
  • The device detection uses the same process as WordPress wp_is_mobile function, so smart phones and tablets are determined as mobile devices.
  • Custom Post Type will only appear if they are enabled.
  • You can exclude post format type from Page Type Activation settings by setting the type of post format to be excluded in Filter Registration.

Settings for each single page

Plugins that are to be used only on a specific page can be configured to activate the plugin for that page only.

Check the filtered results

After setting up, please make sure it is working as you intended.
Also check if you have added, updated, or deleted any plugins.

View the page while logged-in and check the filtered results from the link in Admin-bar.

Click on PLF portion of Admin-bar to see the filtered results for that page.

Filter Priority

Settings for each single page > (URL Filter [Addon]) > Page Type Filter (Admin) > Page Type Filter (Page)

Language switching function for multi-language sites

Simple and easy to use multi-language feature for the case where you want to convert a few pages to multiple languages without changing any permalinks.

Simple language switching for multilingual sites
Very easy and simple to make multilingual – convert a few pages to other languages without changing the permalink.
Simple language switching for multilingual sites

Ajax acceleration filter (Features for plugin developers)

If you are developing a plugin that implements Ajax requests, you can take advantage of this feature.

If you are using Ajax requests and would like to speed things up a bit, give it a try!

Most Ajax requests used by a plugin only target that plugin or its associated add-on plugins. Deactivating any other plugin is not expected to cause problems.
(Only the implementer knows which plugins have code dependencies, so be sure to specify plugins appropriately for each Ajax action.)

Setting _ajax_plf to the slug of the plugin to be enabled in the Ajax request data (if there are related plugins, you can specify multiple plugins separated by commas) will disable all other plugins and speed up the Ajax response.

Ajax requests can be written in various ways, for example, if you are using jQuery, you can specify the plugin slug to be enabled in _ajax_plf with the following code.

jQuery.ajax({ 
    type: 'POST', 
    url: ajaxurl, 
    data: { 
        action: "example_action",
        id: 1234,
        _ajax_nonce: xxxxxxxx,
        _ajax_plf: "example-plugin,example-plugin-addon",                
    }, 
    dataType: 'json', 
}).then(
    function (response, dataType) {

    },
    function () { /* alert("ajax error"); */ }
);  

If _ajax_plf is specified but the Ajax acceleration filter setting in the Plugin Load Filter is not enabled, the plugin will be processed normally without filtering

If you want to filter Ajax such as WordPress core, there is Plugin Load Filter add-on. If you want to filter based on any action, please use the add-on.

Disclaimer

The author is not responsible for any damage caused by the use of this software, so please use it at your own risk.

Introduction of Addon

URL filter addon (sold separately) is available for more advanced filtering than the standard feature.

  • Filtering by pattern matching of requested URL
  • Filtering of taxonomy (categories, tags, etc.) by specific terms
  • Filtering of Ajax requests by specific actions

These three features provide powerful plugins filtering

For example, it is possible to filter plugins for login page, AMP page, admin dashboard, REST API(wp-json), Ajax(admin-ajax/wc-ajax) and other requests.

You can also import/export the URL filter configuration data. We provide URL filter data for WooCommerce as a sample.

If you are using WooCommerce plugin, you can easily improve the performance of your WooCommerce related pages by customizing it based on WooCommerce URL filter data in this sample.

For more information, please see the Addon page below.

WordPress Plugin : Plugin Load Filter Addon
The Plugin Load Filter Addon has three powerful filtering features. 1. Filtering by pattern matching of requested URL 2. Filtering of taxonomy (categories, tags, etc.) by term 3. Filtering of Ajax requests by action
WordPress Plugin : Plugin Load Filter Addon

go-to-top