WP-CLI is a great tool and we use it every day ourselves for managing WordPress. In this article we have listed helpful commands we use regularly. To begin using WP-CLI commands you need to be logged in to your site using SSH. To use SSH you need an SSH Terminal. On Mac there is a program called Terminal. On Windows many users use PuTTY.
ssh USERNAME@SERVERNAME (for example: ssh [email protected])
You will be prompted for your password, and can log in.
WP-CLI manual and help commands
Display the WP-CLI manual
There are a lot of WP-CLI commands. Writing this command gives you the full WP-CLI manual. Additionally it also outlines global parameters.
Get more information on a specific command
WP-CLI manual can be much to grasp and not very specific. Writing help before your command gives you more specific information about the command.
wp help <command>
Install WordPress and check core
Install WordPress – Navigate to ~/public/ folder and run the command
wp core download
Check WordPress core version installed
wp core version
Update WordPress core to latest version
wp core update
Check WordPress plugins installed
Display every plugin installed in a list. Additionally lists plugin status, update and version.
wp plugin list
To get the status of all plugins
wp plugin status
Install our Servebolt-Optimizer plugin and activate
wp plugin install servebolt-optimizer --activate
wp db export
wp db import <name.sql>
Edit config file
wp config edit
wp search-replace [old url] [new url] --all-tables
Check website home and site URL
wp option get home
wp option get siteurl
Create admin user
wp user create [username] [e-mail] --role=administrator
Delete admin user
wp user delete <username>
List all users:
wp user list
Debugging and tools
wp profile stage wp doctor check --all
Put your site in maintenance mode
wp maintenance-mode activate
Deactivate maintenance mode
wp maintenance-mode deactivate
Flushes the WordPress object cache
wp cache flush
Run all cron jobs
wp cron event run --all
For more WP-CLI commands, check out the official WordPress documentation.
WP-CLI for Servebolt Optimizer
Our plugin ‘Servebolt Optimizer’ also allows the use of CLI. Read more on How to use Servebolt Optimizer for WordPress.
Give us your feedback on this article
Servebolt’s new plans and pricing model put a greater focus on customization and flexibility while taking advantage of our amazing performance and scalability.
✅ More storage included in all plans
✅ Lower storage pricing
✅ More cost efficient scaling of traffic and Dynamic Requests
✅ More production environments in all plans
✅ More Servebolt CDN hostnames included in all plans