Install, activate and deactivate WordPress plugins with WP-CLI
WP-CLI is a command line tool that helps you perform different actions on your WordPress site. If you're comfortable with using SSH commands, you'll notice that WP-CLI has simplified commands created for WordPress sites. Here's how you can install, activate, and deactivate WordPress plugins with commands available in WP-CLI.
- An SSH app. We suggest PuTTY for Windows, or Terminal for macOS.
- Your FTP details. If you don’t have them already written down, you should find your FTP host, username, and password:
- For your FTP host, you can use either your domain name or your IP address.
- You can find your FTP username and password in your hosting account for Linux Hosting with cPanel or Managed WordPress Hosting (steps 1-7).
- Connect to your hosting account with SSH.
- Use the bash command ls to list files and folders, and cd and ../ to move through directories until you're in the directory with your WordPress files.
- Enter the following commands to see the list of plugins installed on your site, install a new plugin, and activate or deactivate an existing one:
- To list all plugins installed on your site:
wp plugin list
You'll also see if a plugin is active or inactive. - If there are plugins you don’t intend to use, you can delete them with the following command:
wp plugin delete plugin-name
In the code above, replace plugin-name with the actual name of the theme you want to delete. - To install a plugin from the WordPress repository:
wp plugin install plugin-name
In the code above, replace plugin-name with the actual name of the plugin you want to install. - To install a plugin from a .zip file, upload the plugin .zip file to the folder with your WordPress installation using FTP or File Manager. Then, enter the following command:
wp plugin install plugin-name.zip
In the code above, replace plugin-name.zip with the actual name of the .zip file you've previously uploaded. - To activate a plugin installed on your site:
wp plugin activate plugin-name
In the code above, replace plugin-name with the actual name of the plugin you want to activate. - To activate all plugins installed on your site:
wp plugin activate --all
- To deactivate a plugin installed on your site:
wp plugin deactivate plugin-name
In the code above, replace plugin-name with the actual name of the plugin you want to deactivate. - To deactivate all plugins installed on your site:
wp plugin deactivate --all
- To list all plugins installed on your site:
wp plugin install plugin-name --activate
Once you’ve run the WP-CLI commands to manage your plugins, you can enter the wp plugin list
command again if you want to double-check the list of active and inactive plugins on your site.
More info
- Run updates in WordPress with WP-CLI
- Troubleshooting WordPress
- Want to know more about WP-CLI? Find developer specific info on their official site.