What is wp-cli?
- WP-CLI is the command line interface for WordPress.
- It is an extensible tool for installing and maintaining WordPress.
- Everything you can do from a browser, can also be done using the wp-cli.
In this guide we will learn some useful commands and create scripts to automate some common tasks.
Here are some of the most useful commands:
-
wp plugin update --allUpdate all plugins that can be updated. -
wp db exportExport the database an an SQL dump. -
wp checksum coreVerifies the integrity of the WordPress core and makes sure that the core files have not been tampered with. -
wp plugin install user-switching --activateInstall and activate a wordpress plugin. -
wp transient delete --allDelete transient data.
Let's automate some common tasks using wp-cli:
User Create/Update/Delete/Generate:
- Create an
editornamedbobwith the emailbob@example.comand passwordb0bp@s52@0#2$3
wp user create bob bob@example.com --role=editor --user_pass=b0bp@s52@0#2$3
- Generate 100 subscribers
wp user generate --count=100 --role=subscriber
Top comments (0)