WordPress has a user-friendly graphical interface that makes site management simple.
But did you know there’s another way to run your website?
Meet WP-CLI, the WordPress Command Line Interface. It does everything WP Admin can, plus more.
You can use it to interact with your site through the command line in a terminal, which can actually save you a lot of time — whether you’re managing content, plugins, themes, users, or anything else.
In this guide, we’ll cover what WP-CLI is and share some useful commands to help you get up to speed.
Whether your site’s hosted by WordPress.com or another provider, WP-CLI could be the skill upgrade you’re looking for to make managing sites more efficient and flexible.
What is WP-CLI?
WP-CLI is the official command-line interface for WordPress. It’s been built to help developers manage their sites more quickly and flexibly.
Instead of managing a site through the graphical WP Admin interface in a browser, WP-CLI lets you run powerful commands from your choice of terminal software.

For example, with commands, you can:
- Install a list of plugins on a site
- Assign multiple posts to a different user
- Create new users
- Delete all spam comments.
You can even create a new WordPress installation, switch to a different version of WordPress core, and search for and replace strings in the database — things you can’t do from WP Admin.
The story behind WP-CLI
WP-CLI is an open-source project, just like WordPress itself.
It was originally created by Andreas Creten, Cristi Burcă, and former Automattician Daniel Bachhuber, and is now maintained by Alain Schlesser with contributions from developers all over the world.
To ensure compatibility with the latest versions of WordPress, WP-CLI follows a regular release cycle. Updates are usually rolled out every three to four months and include new commands and improved performance.
At its core, WP-CLI aims to make WordPress more developer-friendly.
Once you get comfortable with it, you can manage one or many sites more efficiently — and even automate tasks you’d never be able to in WP Admin.
How to install WP-CLI
Some web hosts include WP-CLI by default — and WordPress.com is one of them.
To use WP-CLI on WordPress.com, your site needs to be on the Business or Commerce plan.
First, make sure you have SSH access to the server where WordPress is installed.
To check if WP-CLI is installed, try running a version check by entering the following command:
wp cli version
If WP-CLI is installed, you’ll see something like:
WP-CLI 2.12.0
If not, you’ll get a message such as:
command not found: wp
If WP-CLI isn’t installed yet, follow these installation instructions.
Why use WP-CLI?
The main reasons to use WP-CLI over WP Admin are the efficiency and access advantages.
It lets you:
- Execute commands in seconds instead of clicking through multiple screens in WP Admin, saving time when setting up new sites or managing existing ones.
- Keep working even if a problem prevents you from accessing WP Admin — for example, a plugin conflict. In those cases, WP-CLI lets you disable plugins, create user accounts, and update WordPress core, all without using WP Admin.
- Perform tasks that WP Admin doesn’t allow without installing extra plugins, such as interacting with the database or running bulk actions like installing and activating multiple themes or plugins with one command, generating dummy content, rolling back WordPress core or plugin versions, and managing multiple sites on the same server from a single command.
- Combine WP-CLI commands into chains or scripts to automate entire workflows — for example, setting up a new site, configuring settings, creating user accounts, installing plugins, and generating dummy content, all from one script.
Sure, you need to learn a new way of working with WordPress to get the full benefits of WP-CLI.
However, it doesn’t take long to get familiar with this approach, and once you are, you’ll be working much more efficiently.
If your site is hosted on the WordPress.com Business or Commerce plan, you can use WP-CLI plus get access to a few WordPress.com-only commands, some of which we cover later in this guide.
The best part? As WP-CLI was built for developers, you get a lot of freedom in how you use it.
Examples of common WP-CLI commands and what you can do with them
Let’s go over some examples of common commands and why you might want to use them.
Before we get to the examples, it’s worth taking a look at the format of the commands.
WP-CLI commands generally follow this structure:
wp <command> <subcommand> [arguments] [--flags] [--flag=value]
Every command starts with wp, which tells the shell you’re running a WP-CLI command. wp is then followed by a command and often a subcommand.
Examples include plugin and list — the command for listing all the plugins installed on the site:
wp plugin list

The commands can also include arguments, such as:
wp plugin update hello-dolly
This command updates the hello-dolly plugin (if an update is available).
Flags can also be added to commands. They start with — and either toggle options or pass a value to the command.
For example, when adding the –status=active flag to the wp plugin list command, it will only list the active plugins on the site:
wp plugin list --status=active

You can also chain commands together using &&, such as:
wp plugin install contact-form-7 --activate && wp plugin install akismet --activate && wp theme install twentytwentyfive --activate
This command installs and activates the Contact Form 7 and Akismet plugins, along with the Twenty Twenty-Five theme.
You can add –help to any command to view its subcommands, flags, and other information in WP-CLI.
For example:
wp plugin --help
wp plugin list --help
As we go through the examples, you’ll get a better idea of how WP-CLI commands are structured.
You can use WP-CLI through terminal software, including the free Windows Terminal and macOS Terminal apps.
You can also use loops and Bash scripts with WP-CLI to build more advanced, automated workflows — performing bulk updates, managing multiple sites, and streamlining complex WordPress maintenance tasks with a single command.
How to manage WordPress plugins with WP-CLI
wp plugin is a handy command for interacting with plugins on a site via WP-CLI.
It lets you install, update, and delete plugins using commands rather than navigating multiple steps in WP Admin — and saves you a lot of time.
For example, if you often set up new sites and have a list of plugins from the WordPress.org Plugin Directory that you always install, you can achieve this with a single time-saving command.
You can also easily update plugins you’ve installed from the WordPress.org Plugin Directory from the command line. Switching to different versions of a plugin, including older versions, from the command line is straightforward, too.
Finally, you can install and update plugins from other sources using WP-CLI. This won’t work for all plugins, as you’ll need to enter their URL, and WP-CLI must be able to access the ZIP file. However, if the files are accessible, then you should be able to install them.
Let’s have a look at some of the most useful wp plugin commands.
wp plugin list
Use the following command to see which plugins are installed on the site:
wp plugin list

This command not only lists all the plugins installed on the site, but also displays their status, version number, and whether an update is available.
You can add flags to the wp plugin list command to modify what it returns, such as:
wp plugin list --update=available
This command will only list the plugins that have an update available.
You can see all the flags available for a specific command by adding the –help flag to it.
For example:
wp plugin list --help
wp plugin update
If the site you’re working on has plugins installed that are hosted in the WordPress.org Plugin Directory and have an update available, they can be updated using the following command:
wp plugin update --all
You can exclude plugins from the update by using the –exclude flag:
wp plugin update --all --exclude=akismet
Excluding a plugin can be useful if you haven’t tested the latest version of a plugin and don’t want to install it.
As you can see below, all plugins have been updated, except for Akismet, as requested.

wp plugin install
WP-CLI can be used to install plugins hosted in the WordPress.org Plugin Directory.
You can also install plugins by entering the path to a local zip file or a URL to a remote zip file.
To install one or more plugins from the WordPress.org Plugin Directory, use the following command appended by the name of the plugin(s):
wp plugin install <plugin-name>
For example, to install BuddyPress and Contact Form 7, enter:
wp plugin install bbpress contact-form-7

When entering the name of the plugin, you must use the plugin’s slug in the WordPress.org Plugin Directory.
To find the plugin’s slug, visit the plugin page in the WordPress.org Plugin Directory and locate the slug in the URL:
Image: WP-CLI-slug-example-one
If you’d like the plugins also to be activated after installation, add the –activate flag to the end of the command:
wp plugin install bbpress contact-form-7 --activate
You can find more information about installing plugins, including instructions on how to install plugins not listed in the WordPress Plugin Directory, on the wp plugin install page of the WordPress Developer Resources site.
wp plugin deactivate
You can also deactivate one or more plugins from the command line.
This can be especially useful if the site has become unresponsive due to a plugin-related issue that’s preventing you from accessing WP Admin and deactivating the plugin via the browser.
Some of your options for deactivating plugins include deactivating a specific plugin by name, using the –all flag to deactivate all plugins, and deactivating all plugins except for specific ones.
For example, to deactivate a specific plugin, use the following command:
wp plugin deactivate akismet
To deactivate all plugins, use this command:
wp plugin deactivate --all
To deactivate all plugins except for specific plugins, use the following command:
wp plugin deactivate --all --exclude=akismet,hello-dolly
You can view the other options in the wp plugin deactivate command documentation, and for more plugin-related commands, view the wp plugin command documentation.
How to manage WordPress posts using WP-CLI
You can also work with posts and pages using WP-CLI.
wp post list
First up, you can quickly get a list of all posts on a site using the following command:
wp post list

To see a list of pages, add this flag to the command:
wp post list --post_type=page
You can see a list of posts and pages using this command:
wp post list --post_type=page, post
The wp post list page of the WordPress Developer Handbook provides more information about retrieving lists of posts.
wp post create
As you might expect, the wp post create command lets you create posts and pages with WP-CLI.
If you regularly set up new sites that include the same set of pages, such as about, contact, and services pages, you can quickly create those pages using a single command.
For example, the following command will create a post with the title “Created Using WP-CLI.”
wp post create --post_title="Created Using WP-CLI"
To create more than one post, you can chain multiple commands together using &&:
wp post create --post_type=page --post_status=publish --post_title='Home' && wp post create --post_type=page --post_status=publish --post_title='About' && wp post create --post_type=page --post_status=publish --post_title='Contact'

By default, new posts are saved as drafts.
However, you can change this by using the –post_status= flag and adding a command, such as publish, draft, or pending.
For example, to create a new post with the title “Created Using WP-CLI” with its status set to published, use the following command:
wp post create --post_title="Created Using WP-CLI" --post_status=publish
You can also add content to the post, assign an author, set the publish date, and more by using the appropriate flags.
More information about the wp post create command can be found in the WP-CLI documentation.
wp post generate
If you’re starting a new site and want to populate it with placeholder content, then the wp post generate command will come in handy.
This command is deal for creating test content for a new site design or populating a site with thousands of posts to test performance.
It creates multiple posts with a single command.

Like with other commands, you can add flags to the wp post generate command.
wp post generate --count=10
Other flags that can be used with wp post generate include: –post_type=, –post_status=, –-post_author=, and –post_date=.
For example:
wp post generate --count=10 --post_type=page --post_status=draft --post_author=1 --post_date="2025-01-15 12:15:00"
The above command will create 10 draft pages by the author with ID 1 with the creation date and time set to January 15, 2025, 12:15 pm.
You can find out more about the wp post generate command in the WordPress Developer Handbook.
wp post update
You can also update or change existing posts using WP-CLI.
The wp post update command flags let you update the title, body, excerpt, publish date, status, and author.
As you can update multiple posts at once, this command is useful for changing the status for multiple posts from published to draft or assigning a different user as the author.
When updating multiple posts with a single command, you must refer to the posts using their ID. To see the IDs for each post, use this command:
wp post list
Once you have the IDs for each post you want to update, you can refer to them in the command, separated by a space.
Here’s an example of a wp post update command that updates multiple posts:
wp post update 1 125 283 --post_author=2
This command changes the author of the posts with IDs 1, 125, and 283 to the user with ID 2.

(To view the list of users and their IDs, use the wp user list command.)
To build upon that command, if you wanted to change the author of all posts by a specific author to a different author, you could use this command:
wp post update $(wp post list --author=1 --format=ids) --post_author=2

This command retrieves a list of all posts authored by the author with author ID 1, then updates or changes them so that the author is now the one with ID 2.
You could use the same approach to change the status of all published posts to draft by using this command:
wp post update $(wp post list --post_status=publish --format=ids) --post_status=draft
You can see what else is possible with this command on the wp post update page of the WP-CLI documentation.
wp post delete
Deleting posts is another task that you can carry out with WP-CLI.
Again, the post IDs are used when specifying which post(s) to delete:
wp post delete 649

To delete multiple posts, separate the IDs with a space:
wp post delete 649 300 150
By default, posts are moved to the trash. However, you can use the –force flag to skip the trash folder and delete the post:
wp post delete 648 --force
If you want to delete all pages, you can use the following command:
wp post delete $(wp post list --post_type=page --format=ids)

This command deletes all posts by a specific user:
wp post delete $(wp post list --post_author=2 --format=ids)

How to manage WordPress themes with WP-CLI
The wp theme commands also let you carry out several theme-related tasks on a site.
wp theme list
To quickly view a list of all themes on the site, along with their status, whether an update is available, and the version number, enter the following command:
wp theme list

wp theme activate
You can activate a specific installed theme using the following command:
wp theme activate twentytwenty

wp theme install
Like plugins, you can install themes from the command line.
If you want to install a theme from the WordPress Theme Directory, you’ll need to use its slug.
Like plugins, the slug is in the URL of the theme’s page in the WordPress Theme Directory.
For example, if you want to install the Hello Biz theme, you need to enter its name as hello-biz based on its slug.
wp theme install hello-biz

If you want to activate the theme after installing it, add the –activate flag:
wp theme install hello-biz --activate
wp theme update
A single command can update all of the themes that have an available update:
wp theme update --all
You can also exclude themes from the update by using the –exclude flag:
wp theme update --all --exclude=twentytwenty
How to manage WordPress comments with WP-CLI
Besides, the wp comment command gives you a quick way to view and delete spam comments on the site, as well as interact with comments in other ways.
You can see the comments on a site by using the following command:
wp comment list
However, this doesn’t always include spam comments in the list. To see spam comments, use this command:
wp comment list --status=spam
Then, to delete the spam comments, use the wp comment delete command with the wp comment list command:
wp comment delete $(wp comment list --status=spam --format=ids)
The above are just a few examples of how you can use WP-CLI to interact with your WordPress site outside of the WP Admin interface.
Hopefully, this has inspired you to start interacting with WordPress from the command line.
For more information on using WP-CLI, check out the complete list of commands in the documentation.
Cool WordPress.com-specific WP-CLI commands
WP-CLI is included with the WordPress.com Business and Commerce hosting plans.
Some core commands aren’t supported, but there are a few others that are exclusive to WordPress.com sites.
1. wp –help
To see exactly what’s available on the WordPress.com Business and Commerce hosting plans, enter the following command:
wp --help
Doing so will reveal all of the WP-CLI commands available to your site based on your plan.
2. wp wpcomsh diag
wpcomsh is a WordPress.com-specific command that includes several useful subcommands for managing your site.
One such command is wp wpcomsh diag.
This command runs site diagnostics tests and outputs the results, including the status of plugins, accounts with administrator access, details of active WordPress.com hosting plans and services, critical PHP errors, and more.
It’s a quick and easy way to get a detailed overview of a site’s status.
3. wp wpcomsh plugin
The wp wpcomsh plugin command lets you switch between using the WordPress.com-optimized version of a plugin and the standard WordPress.org version.
For example, if you use the command:
wp wpcomsh plugin use-managed woocommerce
The site will start using the WordPress.com-optimized version of the WooCommerce plugin rather than the version available from the WordPress.org Plugin Directory.
You might want to use this command if you’re setting up a new site that needs to be identical to an existing site and is using a specific version of a plugin.
4. wp wpcomsh plugin-dance
If there are errors on the site, the following command disables all plugins and enables them one by one to check if a specific plugin is causing the issue:
wp wpcomsh plugin-dance
You can also manage Jetpack and WooCommerce via WP-CLI.
For more WordPress.com-specific WP-CLI commands, check out the complete list in the WordPress.com Developer documentation.
As you can see, being able to use WP-CLI is another reason why WordPress.com isn’t just for hosting simple blogs; it’s a developer-friendly platform with advanced tooling.
Learn more about WP-CLI
There’s a lot more you can do with WP-CLI, from checking out the full list of commands to creating your own custom commands.
You can also create Bash scripts that contain multiple WP-CLI commands. Then, instead of running each command individually, you can run the entire script at once.
For example, you could create a Bash script called update.sh that includes WP-CLI commands to update all plugins and themes:
wp plugin update --all
wp theme update --all
You can then run the script with ./update.sh. The script’s contents will execute, which in this case, will update the themes and plugins on the site.
That’s just a sample of what’s possible with WP-CLI. To learn more, refer to the online handbook.
Ready to start using WP-CLI?
WP-CLI is a great tool for developers and site owners who want more control over their site while spending less time clicking around in WP Admin.
The biggest hurdle to getting started is usually a mental one.
In most cases, opening your terminal software and logging in for the first time takes only a few minutes. After that, you’ll have a faster, more efficient way to manage your site.
Beyond its speed and efficiency, WP-CLI offers other practical advantages.
You can deactivate plugins and themes, toggle settings when WP Admin is inaccessible, and even generate dummy content with a single command.
To try it out, sign up for the Business or Commerce plan on WordPress.com.
Another useful tool to explore is WordPress Studio, a free open-source desktop app from WordPress.com for building local WordPress sites. In addition to letting you spin up sites in seconds, sync with WordPress.com or Pressable, and import any WordPress site to work on locally, it gives you a quick, easy way to try out WP-CLI in a safe environment.
