How to Switch Off All WordPress Plugins

 

I just picked up a very useful tip on Dougal Campbells blog that I thought I should note down for posterity, especially with so many people planning to upgrade to WordPress 2.1 in the near future.

I disabled all the plugins by renaming the plugin directory temporarily and reloading the page (WP will automatically disable any plugins that it can’t load up, in case you weren’t aware of that trick).

Yes it is obvious when you think about it, but so many tips and tricks are the same.

However this is something you should think about testing before you attempt an upgrade to WordPress 2.1 because many plugins have very poor instructions for adding code, that could end up breaking your blog if used, and for some reason you switch off the plugin in question.

For any plugin that you manually have to add code to your theme in order for it to display, you should always use some form of logic to test whether it exists.

One of the best sources for how to do this as a plugin writer is Headzoo’s tips and tricks.

however for a WordPress user presented with a plugin they are given installation instructions for, this is what you need to do.

As an example the code to include for a Bumpzee widget (picking on someone I know and who will probably fix this within 60 minutes as he never seems to sleep)

<?php bump_this_widget(); ?>

This should be changed to

<?php if (function_exists('bump_this_widget')) bump_this_widget(); ?>

If you go through your modified themes before you upgrade to WordPress 2.1 and ensure that all function calls you make include some logic, then any problem solving afterwords will be much more straight-forward, and won’t take down your site just because you switch a plugin off.

 

Liked this post? Follow this blog to get more. Follow

Comments

  1. says

    This is great Andy. I sometimes start a new blog but want to use plugins from the other blog, this will save time. Cheers!
    Regards, Don.

Trackbacks