less wordpress-disable-or-enable-all-plugins.md
WordPress: Disable or Enable All Plugins
# historical archive — written years ago, kept as it was. Some info is dated.
It can happen that you can no longer properly access the administration area of your WordPress site. Sometimes a plugin can be the sole culprit of what’s happening. You therefore need to deactivate the plugins, log back into the site and then investigate the problem. Here are some examples that lead to disabling or enabling plugins.
Disclaimer: I remind you to make a backup of the entire database and, if necessary, of the entire site before making any kind of change. Also, these methods refer to a standard WordPress installation. In the case of WordPress Multisite you’ll also need to consider the plugins active across the entire Network. Finally, the prefix used in the examples is the classic wp_ which must be changed as needed.
Via DataBase
If you can run a query on the database, you’d do well to first retrieve the active plugins:
SELECT * FROM wp_options WHERE option_name = 'active_plugins';
Then deactivate everything:
UPDATE wp_options SET option_value = 'a:0:{}' WHERE option_name = 'active_plugins';
To re-enable everything, just rewrite the last query replacing a:0:{} with the output of the first query.
Via FTP
With an FTP client, access the Root Directory of your site. Move into the /wp-content/ folder and rename the plugins folder to plugins.deactivate.
Via Shell Command-line
In this case we’ll proceed by renaming the individual plugins. It will be easier to re-enable them one at a time to figure out which one might be causing the site access problem.
Move into the {DOCUMENTROOT}/wp-content/plugins. folder. We’ll use the rename command to achieve our goal.
rename 's/^/0disable_/g' * -v
As you’ll notice, we’ve added the prefix 0disable_ to each plugin directory.
Now, by removing the prefix we can re-enable the plugins one at a time. In general, to re-enable them all at once just run the following command:
rename 's/^0disable_*//g’ * -v
Only act if you know what you’re doing! It’s up to you to figure out which method is most appropriate for the goal you intend to pursue.