WP-CLI¶
WP-CLI is the command line interface for WordPress. Thanks to this tool you can quickly install WordPress, additional plugins / templates or update them.
Initial configuration¶
Before installing WP-CLI:
Installation of WP-CLI¶
mkdir ~/bin
wget -O ~/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x ~/bin/wp
Installing WordPress in the selected directory¶
wp core download --locale=en_GB --path=/usr/home/LOGIN/domains/DOMAIN/public_html
Where:
- LOGIN is the username.
- DOMAIN is your domain name.
Commands¶
Info
The commands should be run from the directory where WordPress is installed.
Updated WordPress engine with database¶
wp core update wp core update-db
Backing up the database¶
wp db export path/to/directory/mycopy.sql
Restoring a copy of the database¶
wp db import path/to/directory/mycopy.sql
Plugin installation/uninstallation¶
wp plugin install/uninstall PLUGIN_NAME
Plugin activation/deactivation¶
wp plugin activate/deactivate PLUGIN_NAME
Installing/uninstalling the theme¶
wp theme install/delete THEME_NAME
Updated the theme¶
wp theme update THEME_NAME
The full list of commands is available at: https://developer.wordpress.org/cli/commands/