Most used wp-cli commands

Probably the most used wp-cli commands are the core, plugin, theme. We will discuss a little each one of them. Before running any wp-cli commands be sure to switch to the right directory:
cd /home/wp_directory

1. wp coreĀ – it installs, updates and manages a WordPress installation.
– to download the installation package
wp core download --locale=en_US

– to create the wp-config.php file needed for the installation process
wp config create --dbname=database_name --dbuser=wp_username --dbpass=wp_password

– to install WordPress
wp core install --url=domain.com --title=Example --admin_user=supervisor --admin_password=strongpassword --admin_email=name@domain.com

– to check if an update is available:
wp core check-update

-to update to the latest version:
wp core update

2. wp plugin – manages plugins
– to activate a plugin
wp plugin activate plugin-name

– to deactivate a plugin
wp plugin deactivate plugin-name

– to delete a plugin
wp plugin delete plugin-name

– to install and activate a plugin
wp plugin install plugin-name --activate

– to list all plugins
wp plugin list

– to update all plugins
wp plugin update --all

3. wp theme – manages themes
– to install the latest version of a theme and activate it
wp theme install twentynineteen --activate

– to activate a theme already installed
wp theme activate twentynineteen

– to get a list of the installed themes
wp theme list

– to update all the themes installed
wp theme update --all

Related articles:
How to install wp-cli on your server

References:
WP-CLI Commands

Share this post: