Quickly Disable or Enable All WordPress Plugins via the Database

by Jeff Starr on Monday, February 18, 2008 30 Responses

Recently, while dealing with the dreaded white screen of death, I found myself unable to login to the WordPress Admin area to manually disable all of the plugins used here at Perishable Press. In the past, I have dealt with this situation by simply deleting all plugin files from the server, however this time, time was of the essence — I had only a few minutes with which to troubleshoot, diagnose, and ultimately resolve the deadly white-screen syndrome. Fortunately, after a few minutes of digging through the WordPress Codex, I had discovered enough information to successfully complete my mission. Now that the fiasco is over, I want to share a simple technique for quickly disabling and (re-)enabling your entire set of WordPress plugins.

In the blink of an eye..

Before beginning, make a backup copy of your database. Then, login to your database using phpMyAdmin (or whatever), and navigate to the “active_plugins” column of the “wp_options” table using the following SQL query (edit the default WordPress table prefix “wp_” if needed):

SELECT * FROM wp_options WHERE option_name = 'active_plugins';

Once the active_plugins column appears, click to edit it. You will see something similar to the following, depending on the number and type of plugins you have installed:

a:31:{i:0;s:13:"AddMySite.php";i:1;s:19:"akismet/akismet.php";i:2;s:23:"all_in_one_seo_pack.php";i:3;s:16:"authenticate.php";i:4;s:28:"breadcrumb-navigation-xt.php";i:5;s:18:"codeautoescape.php";i:6;s:37:"contact-coldform/contact_coldform.php";i:7;s:32:"custom-query-string-reloaded.php";i:8;s:30:"customizable-post-listings.php";i:9;s:33:"dd-sitemap-gen/dd-sitemap-gen.php";i:10;s:20:"download-counter.php";i:11;s:13:"feedcount.php";i:12;s:13:"full_feed.php";i:13;s:15:"get-weather.php";i:14;s:36:"google-sitemap-generator/sitemap.php";i:15;s:13:"gravatars.php";i:16;s:19:"kill-admin-nags.php";i:17;s:18:"landingsites13.php";i:18;s:30:"nofollow-free/nofollowfree.php";i:19;s:17:"ol_feedburner.php";i:20;s:16:"plugins-used.php";i:21;s:22:"popularity-contest.php";i:22;s:39:"search-everything/search_everything.php";i:23;s:27:"simple-tags/simple-tags.php";i:24;s:26:"simple_recent_comments.php";i:25;s:18:"simple_twitter.php";i:26;s:25:"subscribe-to-comments.php";i:27;s:24:"the-excerpt-reloaded.php";i:28;s:18:"theme-switcher.php";i:29;s:9:"top10.php";i:30;s:16:"wp-db-backup.php";}

That entire array of code represents every active plugin on your site. Thus, to quickly disable all plugins without using the WP Admin area, highlight the entire block of code, cut it out, and paste it into a safe, offline text file. After removing the code, click the button to save your changes and that’s it. All WordPress plugins are now deactivated (yet still installed, and with all plugin options intact). This obviously is a huge time-saver that really comes in handy during those mission-critical, time-sensitive situations where every second counts. Once you are ready to re-activate your entire set of plugins, simply cut/copy & paste the preserved code back into the “active_plugins” field. Click save and done. Again, don’t forget to backup your database before editing it ;)

Nuke ‘em!

Alternately, here is a one-second query to disable all plugins:

UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins';

Upon execution, this query will clear the active_plugins field of all active plugins (duh), effectively disabling (without uninstalling or modifying) the entire set. This method is great if you plan on re-enabling each plugin individually, say, after resolving some heinous server error. Whereas the previous technique makes it easy to re-enable all plugins en masse, this query is perfect for simply “nuking” all active plugins with no remorse. ;)


30 Responses
[ Gravatar Icon ]

Ozh#1

Or: just rename the wp-content/plugins/ folder.
You will have to manually reactivate the plugins after you rename the plugins folder back to its original name, but all plugin options are preserved too.

[ Gravatar Icon ]

Perishable#2

Ahh yes, good call there, Ozh! Simply renaming the plugins folder is another efficient, effective technique for quickly disabling all plugins.. Why am I not surprised that I haven’t thought of this myself? Thanks for the tip! ;)

[ Gravatar Icon ]

orexis#3

Thank you, that’s exactly what I was looking for.

[ Gravatar Icon ]

Perishable#4

My pleasure! Thanks for the feedback!

[ Gravatar Icon ]

pilotmike#5

Thank you very much for this post. You saved me from a bad maintenance mode plug-in during the upgrade from 2.5.1 to 2.6.

There is a reason why they tell you to disable ALL plug-ins. :)

Thanks a ton for taking the time to put this up!

[ Gravatar Icon ]

Perishable#6

Happy to help, pilotmike — thanks for the comment!

[ Gravatar Icon ]

Kyle#7

Thanks — that was a big help!

[ Gravatar Icon ]

Jeff Starr#8

My pleasure, Kyle — glad to be of service! :)

[ Gravatar Icon ]

Phoenix#9

Hi, i’m new on Wordpress. I’m googling about how to add ‘notify me off follow-up comments via email’ and land on this page :). I’m glad to know this blog, i’ve got something new to learn. Thanks.

[ Gravatar Icon ]

Jeff Starr#10

Glad to be of service, Phoenix! Thanks for the feedback :)

[ Gravatar Icon ]

Jonathan#11

Thanks. You’ve helped me bring my site back up after my provider moved servers on me and decided not to assist. Avoid Dreamhost.

[ Gravatar Icon ]

Jeff Starr#12

Happy to help, Jonathan — thanks for the heads up on Dreamhost! ;)

[ Gravatar Icon ]

David Radovanovic#13

Thanks for another VERY useful (and FAST) tutorial for an avid fan who seems to get into many a fix only to find himself back at Perishable Press!

[ Gravatar Icon ]

in8sworld#14

Thanks for posting this, I knew that there was probably a quick way in phpmyadmin to turn them off, but didn’t know what to look for. Good to know about renaming the plugins folder too Ozh!

[ Gravatar Icon ]

Paul#15

Thanks, just ran into a problem when I upgraded to wordpress 2.7 and your info helped me out.

[ Gravatar Icon ]

Jeff Starr#16

My pleasure, Paul! Glad to be of service! :)

Trackbacks / Pingbacks
  1. Disable WordPress plugins at Rage on Omnipotent
  2. Finally. | Life, the Universe, and Everything
  3. Steve Dougherty’s Blog » Blog Archive » WordPress Upgrade, RSI, and the LAN
  4. Steady on, little server - sleptlate.org
  5. Library Voice » A little snag in upgrading to WordPress 2.8
  6. itsDistracting » Blog Archive » Wordpress would not load
  7. Website Backups & What to Do When They Fail  | Internet Marketing & Lifestyle
  8. Website Data Loss: The Prevention & Cures | The Modern Entrepreneur
  9. Automatic wordpress updates | theInfluence
  10. Omeyas Web caída 4 días | Omeyas Web
  11. Wordpress auto updates | Self Hosted
  12. A Plugin Broke Your WordPress Blog? Here Is What To Do
  13. Problems Looking Better | Coffee Muses
  14. Yves Arsenault » Upgrading blogs to Wordpress 2.9.1
Comments are closed for this post

If you have or need further information, contact me.



Attention: Do NOT follow this link!