WP-CLI is the official command-line tool for WordPress. CLI stands for Command Line Interface, which means you manage your site by typing commands in a terminal instead of clicking around the dashboard.
It sounds scary at first, but it saves a ton of time. Updating every plugin on a site, for example, takes just one short command.
What Can You Do With WP-CLI?
Almost everything you do in the dashboard, and plenty of things you can't. Here are some everyday commands:
wp core updateupdates WordPress to the latest version.wp plugin update --allupdates all your plugins at once.wp plugin install akismet --activateinstalls and activates a plugin.wp user listshows all the users on your site.wp db exportsaves a backup copy of your database.
It works just like a TV remote. You can walk up to the TV and press its buttons, but the remote does the same job faster from your couch.
How to Start Using WP-CLI
- First, check that your host gives you SSH access. Many good hosts include WP-CLI already.
- Now, connect to your server through SSH using a terminal app.
- Next, move into the folder where WordPress is installed.
- Here, type
wp --infoand press Enter. If you see version details, WP-CLI is ready.
If it is not installed, you can download it as a single file and set it up yourself. The official WP-CLI commands reference lists every command with examples.
Search and Replace With WP-CLI
One of the most loved commands is wp search-replace. It swaps old text, like an old URL, across the whole database and handles serialized data safely. You can learn more in our guide on how to perform search and replace in WordPress.
Commands run instantly, and there is no undo button. Take a database backup first, and add --dry-run to wp search-replace to preview the changes.
That's it for WP-CLI. Once you get used to it, you may never want to update plugins one by one again. If you have questions, drop them in the comment box below.