In this article we list a number of useful WP-CLI commands you can run to administer your WordPress website from terminal.
List active plugins on your WordPress site
wp plugin list --status=active
Deactivate a plugin
wp plugin deactivate pluginname
Replace pluginname with the name of your plugin you want to deactivate. For example, to deactivate the ‘hello’ plugin run the following command;
wp plugin deactivate hello
Delete a plugin
wp plugin delete pluginname
Replace pluginname with the name of your plugin you want to delete. For example, to delete the ‘hello’ plugin run the following command;
wp plugin delete hello
Activate a plugin
wp plugin activate pluginname
Replace pluginname with the name of your plugin you want to activate. For example, to activate the ‘hello’ plugin run the following command;
wp plugin activate hello
Install a plugin
wp plugin install pluginname
Replace pluginname with the name of your plugin you want to install. For example, to install the ‘hello’ plugin run the following command;
wp plugin install hello
Install and activate plugin
wp plugin install pluginname --activate
Replace pluginname with the name of your plugin you want to install and activate. For example, to install and activate the ‘hello’ plugin run the following command;
wp plugin install hello --activate
Change WordPress Admin Username
Use the following command to change the username used to login to WordPress. Replace * old_username* with the username you wish to update. Replace new_username with the new user name you wish to use.
Use –dry-run option to run the search without making changes.
wp search-replace old_username new_username --dry-run
When ready run the following command to save changes. Again being sure to replace the placeholder values with your own.
wp search-replace old_username new_username