Disabling a Plugin with WP-CLI
If you are troubleshooting a WordPress Fatal Error and you need to disable a Plugin without access to your WordPress dashboard, you can use these instructions to disable it using the WordPress Command Line Interface, or WP-CLI.
- SSH into your WordPress hosting account, using your Web Host’s instructions for doing so.
- Change directories to the root directory containing your WordPress installation. In these examples, the directory ~/public_html is used in place of the root directory for WordPress.
user@wordpress [~]$ cd ~/public_html/
- Get a list of your plugins with the command wp plugin list:
user@wordpress [~/public_html]$ wp plugin list +-------------------------------+----------+--------+----------+ | name | status | update | version | +-------------------------------+----------+--------+----------+ | akismet | active | none | 4.1.2 | | boldgrid-backup | active | none | 1.9.3 | | boldgrid-backup-premium | active | none | 1.1.2 | | hello | inactive | none | 1.7.2 | | jetpack | inactive | none | 7.4 | +-------------------------------+----------+--------+----------+
In this example, the plugins Akismet, Total Upkeep (previously known as BoldGrid Backup), and Total Upkeep Premium are currently active, and the list of names, or slugs, shows the other inactive plugins you have installed..
- Deactivate a plugin using the command wp plugin deactivate plugin-slug where “plugin-slug” is replaced with the name of the plugin you saw from the previous command:
user@wordpress [~/public_html]$ wp plugin deactivate akismet Plugin 'akismet' deactivated. Success: Deactivated 1 of 1 plugins.
- If you receive an error, you may need to add one of the following modifiers to your command: —skip-themes or –skip-plugins
user@wordpress [~/public_html]$ wp plugin deactivate akismet --skip-themes --skip-plugins Plugin 'akismet' deactivated. Success: Deactivated 1 of 1 plugins.
- Optionally, if you’re running a WordPress Multisite Network, and you’d like to disable the plugin for all of the sites on the network, add the modifier –network to your command, like so:
user@wordpress [~/public_html]$ wp plugin deactivate akismet --network
Congratulations! You now know how to deactivate a plugin using WP-CLI.
SIGNUP FOR
BOLDGRID CENTRAL
200+ Design Templates + 1 Kick-ass SuperTheme
6 WordPress Plugins + 2 Essential Services
Everything you need to build and manage WordPress websites in one Central place.
Diego says:
Does this works with wordpress multisite sitewide plugins ?
Jesse says:
Hello Diego-
Thanks for the great question! I’ve updated the article above to include step 6, where you can see how adding the
--network
modifier to your command can disable a plugin for the entire network.