WP-CLI is a command-line interface for WordPress. Our WordPress image uses WP-CLI to install WordPress, so you can use it to perform updates, modifications, installations,.... We'll show you some examples.
User management
To change the email address of the WPadmin user:
# wp user update WPadmin --user_email=micorreo@midominio.es --allow-root --path=/var/www/html/wordpress/If we want to change the password of the WPadmin user:
# wp user update WPadmin --user_pass=NewPass1346 --allow-root --path=/var/www/html/wordpress/Create a user with the author role:
# wp user create kb kb@midominio.es --role=author --allow-root --path=/var/www/html/wordpress/Change the role of a user:
# wp user set-role kb administrator --allow-root --path=/var/www/html/wordpress/Plugin management
Install and activate the WordPress Seo plugin:
# wp plugin install wordpress-seo --activate --allow-root --path=/var/www/html/wordpress/Deactivate the WordPress Seo plugin:
# wp plugin deactivate wordpress-seo --allow-root --path=/var/www/html/wordpress/Update the WordPress Seo plugin:
# wp plugin update wordpress-seo --allow-root --path=/var/www/html/wordpress/Delete the WordPress Seo plugin:
# wp plugin delete wordpress-seo --allow-root --path=/var/www/html/wordpress/List all plugins installed:
# wp plugin list --allow-root --path=/var/www/html/wordpress/ Update all plugins installed:
# wp plugin update --all --allow-root --path=/var/www/html/wordpress/Search for a plugin, for example import:
# wp plugin search import --allow-root --path=/var/www/html/wordpress/Theme management
Install and activate the Hestia theme:
# wp theme install hestia --activate --allow-root --path=/var/www/html/wordpress/Activate the Hestia theme:
# wp theme activate hestia --allow-root --path=/var/www/html/wordpress/Update the Hestia theme:
# wp theme update hestia --allow-root --path=/var/www/html/wordpress/Delete the Hestia theme
# wp theme delete hestia --allow-root --path=/var/www/html/wordpress/List all themes installed
# wp theme list --allow-root --path=/var/www/html/wordpress/Update all themes installed:
# wp theme update --all --allow-root --path=/var/www/html/wordpress/Search for a theme, for example import:
# wp theme search import --allow-root --path=/var/www/html/wordpress/Other operations
Change the domain for WordPress:
# wp option update home 'http://midominio.es' --allow-root --path=/var/www/html/wordpress/
# wp option update siteurl 'http://midominio.es' --allow-root --path=/var/www/html/wordpress/Update WordPress:
# wp core update --allow-root --path=/var/www/html/wordpress/Search and replace text (dry run):
# wp search-replace oldstring newstring --allow-root --path=/var/www/html/wordpress/ --dry-runSearch and replace text:
# wp search-replace oldstring newstring --allow-root --path=/var/www/html/wordpress/