Deactivate WordPress Plugins with WP-CLI


WP-CLI is a command line interface for WordPress. You can use it to manage your WordPress sites from the command line, including plugin management.

Here is the command you can use to deactivate a plugin:

wp plugin deactivate plugin-name

Replace plugin-name with the actual name of the plugin you want to deactivate.

If you want to deactivate all plugins, you can use:

wp plugin deactivate --all

Remember to run these commands from the root directory of your WordPress installation and ensure that you have the necessary permissions to modify the plugins.

Also note that you may need to specify the path to wp if the WP-CLI binary is not in your system’s PATH, or if you’re running the command from outside the WordPress directory. For example, if wp is installed in /usr/local/bin, the command to deactivate a plugin would look like this:

/usr/local/bin/wp plugin deactivate plugin-name

List All Plugins

Yes, you can list all plugins in your WordPress installation using WP-CLI. The command to do this is:

wp plugin list

This command will provide a list of all plugins, along with details such as their status (active/inactive), version number, and update status.

Remember to run this command from the root directory of your WordPress installation. If you’re running the command from outside the WordPress directory or the WP-CLI binary is not in your system’s PATH, you may need to specify the full path to the wp binary.

Also, note that depending on your setup, you may need to include additional flags or options. For example, if you’re running a multisite installation and you want to list the plugins for a specific site, you could use the --url option to specify the site:

wp plugin list --url=example.com

Replace example.com with the domain of the site you’re interested in.