Disable Plugins on a Single Post/Page in WordPress

So, one of the biggest flaws with WordPress is that, unless the author has written their plugin well, it will load on every single post or page on your website. This is often overkill as there will be some plugins that only apply to a specific section of your website. In an effort to provide greater control, lighten memory load and increase page load times I have written a very simple plugin to control what plugins load where.

Using WordPress’ MU (must use) plugin system, with my Disable Plugins WordPress plugin you can disable plugins on any page, post, category, archive, etc. with a simple regular expression pattern that is matched against the URI. Any matching URI will exclude the plugin you specify.

I’m currently applying for plugin directory distribution, but until then you can get the plugin here:

Download Disable Plugins for WordPress

21 Replies to “Disable Plugins on a Single Post/Page in WordPress”

  1. hello,
    i will appreciate if you can fix the download link, i need it badly.
    i’m tired looking for it in Google, i couldn’t find and easy and understandable solution.
    thank you.

  2. Sorry about the bunk download link guys. I’ve uploaded a copy of the file. Don’t forget that this is an MU plugin and must reside in your /wp-content/mu-plugins folder to work.

  3. Much-needed plugin! Thanks for taking the initiative.

    I created a “mu-plugins” directory and uploaded the files there. Now how do I get it working? It’s not showing up in my list of plugins or anywhere under Settings.

    1. Hey Stephanie, everything should be documented in a comment of the PHP file for use. Its an MU (must use) plugin so it isn’t going to show up in the regular list of plugins, but in a separate section of your plugins area. There is no interface however as it requires manually adding regular expression rules to a configuration file.

  4. #1 – MF’ing THANK YOU Kynatro for being the only non-blinded developer for creating a plugin like this finally.

    Is this plugin still working on WP v3.4+ ??? looks like it hasnt been updated in awhile

  5. Hello, could you please give me an example of a regular expression which will disable a particular plugin on a particular post/page id??

    In your documentation you list an example for disabling Hello Dolly on the home page, but an example of disabling Hello Dolly on a single post id would be FANTASTIC and really help to see how to customize it for any plugin and any particular page. Thanks man for this plugin Ive been searching around ALOT for something like this


    1. Hey Jesse,

      Not really sure how your permalinks are setup, for your blog, but take this example:

      Assuming your permalink structure is something like /%year%/%month%/%day%/%postname%

      You can write a rule like this to disable Hello Dolly for a post at /2012/10/03/my-post-permalink-slug

      ^\/2012\/10\/03\/my-post-permalink-slug hello-dolly

  6. What if your site isn’t mywordpresssite.com but rather mysite.com/directory/blog?
    There can’t be a file called mysite.com/directory/blog.rule because it contains slashes.

    1. The plugin will create (if it has write permissions to do so, otherwise you’ll need to make it yourself) a folder in the mu-plugins folder called “disable-plugins-rules”. Make sure that folder is writeable by the server and the plugin will create a file named after your website. So, for your example that file might exist at “/directory/blog/wp-content/mu-plugins/disable-plugins-rules/mysite.com.rules” – your exclusion rules would go there.

      The filename itself is based off of the host portion of your website to avoid folder name issues. So, if your blog is installed at at mysite.com/directory/blog the file would still be called “mysite.com.rules”. The patterns for exclusions though are matched against the URI, so you would just need to include the /directory/blog portion in your rules. For example, to exclude the “Hello Dolly” (hellodolly) plugin from the /directory/blog/my-first-post URL, you’d write your rules like:

      ^\/directory\/blog\/my-first-post hellodolly

  7. Variables in urls?

    Hey Kynatro, any chance you could point me in the right direction to use this when a variable exist in the url? For example, when
    ?edit=profile is added to the end of a url, a front-end profile page is shown.


    1. The $_SERVER[‘REQUEST_URI’] variable is checked against, so you should be able to match for it if you want to exclude based off of query parameters. This plugin should not affect appearance of a page or which page is rendered though unless you are disabling a plugin that provides the view you are attempting to access.

    1. Actually, the plugin works fine with the current version of WordPress, I just haven’t updated the compatible to version number in a while 🙂 Its updated now if you want to give it a try.

  8. Did you really tested this ? Because that’s what I did for two of my sites, and it’s NOT working 🙁 I followed and double checked every instruction from your description. Maybe I am just unlucky !

    1. Yes, it was tested and it is currently in use in a quite a few of the properties I have worked on. I’d check to make sure that you have characters escaped properly in your regular expressions in the pattern files.

  9. You, my man, are a legend. I needed to disable a particular plugin on a couple of pages, and this is EXACTLY what I was looking for. Have you considered putting it on github? I wouldn’t mind adding a simple gui..

Leave a Reply to andrew Cancel reply