WP-CLI
Introduction#
WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, configure multisite installs and much more, without using a web browser.
Manage themes
Get a list of themes.
$ wp theme listInstall the latest version from wordpress.org and activate
$ wp theme install twentysixteen --activateInstall from a local zip file
$ wp theme install ../my-theme.zipInstall from a remote zip file
$ wp theme install https://s3.amazonaws.com/bucketname/my-theme.zip?AWSAccessKeyId=123&Expires=456&Signature=abcdefGet details of an installed theme
$ wp theme get twentysixteen --fields=name,title,versionGet status of theme
$ wp theme status twentysixteenManage plugins
Get a list of plugins
$ wp plugin list List active plugins on the site.
$ wp plugin list --status=active --format=jsonList plugins on each site in a network.
$ wp site list --field=url | xargs -I % wp plugin list --url=%Activate plugin
$ wp plugin activate hello-dollyDeactivate plugin
$ wp plugin deactivate hello-dollyDelete plugin
$ wp plugin delete hello-dollyInstall the latest version from wordpress.org and activate
$ wp plugin install bbpress --activateManage WP-CLI itself
Display the version currently installed.
$ wp cli versionCheck for updates to WP-CLI.
$ wp cli check-updateUpdate WP-CLI to the latest stable release.
$ wp cli updateList all available aliases.
$ wp cli aliasPrint various details about the WP-CLI environment.
$ wp cli infoDump the list of installed commands, as JSON.
$ wp cli cmd-dumpDownload, install, update and manage a WordPress install.
Download WordPress core
$ wp core download --locale=nl_NLInstall WordPress
$ wp core install --url=example.com --title=Example --admin_user=supervisor --admin_password=strongpassword --admin_email=info@example.comDisplay the WordPress version
$ wp core versionTransform a single-site install into a WordPress multisite install.
$ wp core multisite-convertInstall WordPress multisite from scratch.
$ wp core multisite-install Manage users
List user IDs
$ wp user list --field=IDCreate a new user.
$ wp user create bob bob@example.com --role=authorUpdate an existing user.
$ wp user update 123 --display_name=Mary --user_pass=marypassDelete user 123 and reassign posts to user 567
$ wp user delete 123 --reassign=567Perform basic database operations using credentials stored in wp-config.php
Create a new database.
$ wp db createDrop an existing database.
$ wp db drop --yesReset the current database.
$ wp db reset --yesExecute a SQL query stored in a file.
$ wp db query < debug.sql