Deactivate Plugins per Page
Activating or deactivating plugins on certain WordPress pages is made simple with the “Deactivate Plugins Per Page” plugin. (or on all except a selected page).
This can help speed up your site in a number of ways, the primary one being that many front-end plugins will load their JavaScript and CSS components on each page, even if you only use them on one page.
How it works?
You are able to add rules for the automatic deactivation of active plugins. For instance, if you only use a contact form plugin on the contact page, you can easily write a rule to disable the plugin everywhere else on the site except for the contact page.
Deactivation Rules Options
1. Deactivation Type
- Deactivate on selected URI
- Deactivate on all URI except selected
2. URI selection type
- Page
- Custom
3. [Page] Select pages to extract URI from (it will update automatically if the page slug changes)
4. [Custom] Custom URI condition
- URI equals …
- URI does not equal …
- URI contains …
- URI does not contain …
- URI starts with …
- URI does not start with …
- URI ends with …
- URI does not end with …
5. Affected devices
- All
- Desktop
- Mobile
Plugin Groups
To create deactivation rules that apply to numerous plugins at once, you must first arrange the plugins together into groups.
Debug Mode
Enable debug mode to see what is the URI and which plugins are active/inactive on the current page on the front-end. This will help you create rules and test current ones. A debug box will appear on the front-end if you are an administrator user.
Does it affect the Back-end?
There is an option that, when activated, causes all rules with a Custom URI selection to also have an effect on the back-end, but this option is not enabled by default. In order to prevent difficulties from occurring, certain back-end pages will not be affected. These include the pages that handle the activation and deactivation of plugins, as well as their updates and installations.
Export/Import Rules and Settings
Since version 1.9.0, you are able to export all of the deactivation rules and settings that you have configured for the plugin and then import them onto a different website. Rules that have the Page URI selection type as their selection criteria will be bypassed if the destination site does not have pages with the same ID and slug as the source site. Importing content into numerous sites at once is possible with a multisite.
Custom PHP function as condition (NEW)
Since version 1.15.0, you are able to add the name of your own PHP function to a deactivation rule so that it can be used as an additional condition. This feature was introduced in version 1.15.0. In order for the rule to be valid, your function must likewise have a true result. The function has to be loaded in a must-use plugin in order for it to be accessible before the load time for regular plugins.
Jack (verified owner) –