August used to be a large month for WordPress. WordPress 7 ...
WordPress has a user-friendly graphical interface that makes website control easy.
However do you know there’s in a different way to run your website online?
Meet WP-CLI, the WordPress Command Line Interface. It does the entirety WP Admin can, plus extra.
You’ll use it to have interaction together with your website during the command line in a terminal, which will if truth be told prevent numerous time — whether or not you’re managing content material, plugins, subject matters, customers, or the rest.
On this information, we’ll duvet what WP-CLI is and percentage some helpful instructions that can assist you stand up to hurry.
Whether or not your website’s hosted via WordPress.com or any other supplier, WP-CLI might be the talent improve you’re on the lookout for to make managing websites extra environment friendly and versatile.
WP-CLI is the legitimate command-line interface for WordPress. It’s been constructed to assist builders organize their websites extra temporarily and flexibly.
As an alternative of managing a website during the graphical WP Admin interface in a browser, WP-CLI allows you to run robust instructions out of your number of terminal instrument.

For instance, with instructions, you’ll:
You’ll even create a brand new WordPress set up, transfer to another model of WordPress core, and seek for and exchange strings within the database — issues you’ll’t do from WP Admin.
WP-CLI is an open-source undertaking, identical to WordPress itself.
It was once at first created via Andreas Creten, Cristi Burcă, and previous Automattician Daniel Bachhuber, and is now maintained via Alain Schlesser with contributions from builders in every single place the arena.
To make sure compatibility with the most recent variations of WordPress, WP-CLI follows an ordinary unlock cycle. Updates are in most cases rolled out each 3 to 4 months and come with new instructions and stepped forward efficiency.
At its core, WP-CLI objectives to make WordPress extra developer-friendly.
When you get ok with it, you’ll organize one or many websites extra successfully — or even automate duties you’d by no means be capable of in WP Admin.
Some internet hosts come with WP-CLI via default — and WordPress.com is one in every of them.
To make use of WP-CLI on WordPress.com, your website must be at the Industry or Trade plan.
First, you’ll want to have SSH get right of entry to to the server the place WordPress is put in.
To test if WP-CLI is put in, check out working a model test via getting into the next command:
wp cli model
If WP-CLI is put in, you’ll see one thing like:
WP-CLI 2.12.0
If now not, you’ll get a message reminiscent of:
command now not discovered: wp
If WP-CLI isn’t put in but, practice those set up directions.
The primary causes to make use of WP-CLI over WP Admin are the potency and get right of entry to benefits.
It allows you to:
Certain, you wish to have to be informed a brand new method of operating with WordPress to get the entire advantages of WP-CLI.
Alternatively, it doesn’t take lengthy to get accustomed to this method, and as soon as you might be, you’ll be operating a lot more successfully.
In case your website is hosted at the WordPress.com Industry or Trade plan, you’ll use WP-CLI plus get get right of entry to to a couple of WordPress.com-only instructions, a few of which we duvet later on this information.
The most efficient phase? As WP-CLI was once constructed for builders, you get numerous freedom in how you employ it.
Let’s pass over some examples of commonplace instructions and why chances are you’ll need to use them.
Ahead of we get to the examples, it’s price having a look on the layout of the instructions.
WP-CLI instructions typically practice this construction:
wp [arguments] [--flags] [--flag=value]
Each and every command begins with wp, which tells the shell you’re working a WP-CLI command. wp is then adopted via a command and incessantly a subcommand.
Examples come with plugin and checklist — the command for record all of the plugins put in at the website:
wp plugin checklist

The instructions too can come with arguments, reminiscent of:
wp plugin replace hello-dolly
This command updates the hello-dolly plugin (if an replace is to be had).
Flags will also be added to instructions. They begin with — and both toggle choices or go a worth to the command.
For instance, when including the –popularity=lively flag to the wp plugin checklist command, it’s going to solely checklist the lively plugins at the website:
wp plugin checklist --status=lively

You’ll additionally chain instructions in combination the use of &&, reminiscent of:
wp plugin set up contact-form-7 --activate && wp plugin set up akismet --activate && wp theme set up twentytwentyfive --activate
This command installs and turns on the Touch Shape 7 and Akismet plugins, together with the Twenty Twenty-5 theme.
You’ll upload –assist to any command to view its subcommands, flags, and different knowledge in WP-CLI.
For instance:
wp plugin --help
wp plugin checklist --help
As we pass during the examples, you’ll get a greater thought of the way WP-CLI instructions are structured.
You’ll use WP-CLI via terminal instrument, together with the loose Home windows Terminal and macOS Terminal apps.
You’ll additionally use loops and Bash scripts with WP-CLI to construct extra complicated, automatic workflows — appearing bulk updates, managing a couple of websites, and streamlining advanced WordPress repairs duties with a unmarried command.
wp plugin is a at hand command for interacting with plugins on a website by means of WP-CLI.
It allows you to set up, replace, and delete plugins the use of instructions relatively than navigating a couple of steps in WP Admin — and saves you numerous time.
For instance, when you incessantly arrange new websites and feature a listing of plugins from the WordPress.org Plugin Listing that you just at all times set up, you’ll do so with a unmarried time-saving command.
You’ll additionally simply replace plugins you’ve put in from the WordPress.org Plugin Listing from the command line. Switching to other variations of a plugin, together with older variations, from the command line is easy, too.
In spite of everything, you’ll set up and replace plugins from different resources the use of WP-CLI. This gained’t paintings for all plugins, as you’ll want to input their URL, and WP-CLI will have to be capable of get right of entry to the ZIP record. Alternatively, if the recordsdata are obtainable, you then must be capable of set up them.
Let’s take a look at one of the crucial most beneficial wp plugin instructions.
Use the next command to see which plugins are put in at the website:
wp plugin checklist

This command now not solely lists all of the plugins put in at the website, but additionally presentations their popularity, model quantity, and whether or not an replace is to be had.
You’ll upload flags to the wp plugin checklist command to alter what it returns, reminiscent of:
wp plugin checklist --update=to be had
This command will solely checklist the plugins that experience an replace to be had.
You’ll see all of the flags to be had for a particular command via including the –assist flag to it.
For instance:
wp plugin checklist --help
If the website you’re operating on has plugins put in which can be hosted within the WordPress.org Plugin Listing and feature an replace to be had, they are able to be up to date the use of the next command:
wp plugin replace --all
You’ll exclude plugins from the replace via the use of the –exclude flag:
wp plugin replace --all --exclude=akismet
Except for a plugin will also be helpful when you haven’t examined the most recent model of a plugin and don’t need to set up it.
As you’ll see beneath, all plugins were up to date, apart from for Akismet, as asked.

WP-CLI can be utilized to put in plugins hosted within the WordPress.org Plugin Listing.
You’ll additionally set up plugins via getting into the trail to an area zip record or a URL to a far off zip record.
To set up a number of plugins from the WordPress.org Plugin Listing, use the next command appended via the identify of the plugin(s):
wp plugin set up
For instance, to put in BuddyPress and Touch Shape 7, input:
wp plugin set up bbpress contact-form-7

When getting into the identify of the plugin, you will have to use the plugin’s slug within the WordPress.org Plugin Listing.
To to find the plugin’s slug, consult with the plugin web page within the WordPress.org Plugin Listing and find the slug within the URL:
Symbol: WP-CLI-slug-example-one
Should you’d just like the plugins additionally to be activated after set up, upload the –switch on flag to the top of the command:
wp plugin set up bbpress contact-form-7 --activate
You’ll to find extra details about putting in plugins, together with directions on how one can set up plugins now not indexed within the WordPress Plugin Listing, at the wp plugin set up web page of the WordPress Developer Sources website.
You’ll additionally deactivate a number of plugins from the command line.
This will also be particularly helpful if the website has grow to be unresponsive because of a plugin-related factor that’s combating you from having access to WP Admin and deactivating the plugin by means of the browser.
A few of your choices for deactivating plugins come with deactivating a particular plugin via identify, the use of the –all flag to deactivate all plugins, and deactivating all plugins apart from for particular ones.
For instance, to deactivate a particular plugin, use the next command:
wp plugin deactivate akismet
To deactivate all plugins, use this command:
wp plugin deactivate --all
To deactivate all plugins apart from for particular plugins, use the next command:
wp plugin deactivate --all --exclude=akismet,hello-dolly
You’ll view the opposite choices within the wp plugin deactivate command documentation, and for extra plugin-related instructions, view the wp plugin command documentation.
You’ll additionally paintings with posts and pages the use of WP-CLI.
First up, you’ll temporarily get a listing of all posts on a website the use of the next command:
wp publish checklist

To see a listing of pages, upload this flag to the command:
wp publish checklist --post_type=web page
You’ll see a listing of posts and pages the use of this command:
wp publish checklist --post_type=web page, publish
The wp publish checklist web page of the WordPress Developer Manual supplies extra details about retrieving lists of posts.
As chances are you’ll be expecting, the wp publish create command allows you to create posts and pages with WP-CLI.
Should you frequently arrange new websites that come with the similar set of pages, reminiscent of about, touch, and services and products pages, you’ll temporarily create the ones pages the use of a unmarried command.
For instance, the next command will create a publish with the identify “Created The use of WP-CLI.”
wp publish create --post_title="Created The use of WP-CLI"
To create multiple publish, you’ll chain a couple of instructions in combination the use of &&:
wp publish create --post_type=web page --post_status=submit --post_title="House" && wp publish create --post_type=web page --post_status=submit --post_title="About" && wp publish create --post_type=web page --post_status=submit --post_title="Touch"

By means of default, new posts are stored as drafts.
Alternatively, you’ll trade this via the use of the –post_status= flag and including a command, reminiscent of submit, draft, or pending.
For instance, to create a brand new publish with the identify “Created The use of WP-CLI” with its popularity set to revealed, use the next command:
wp publish create --post_title="Created The use of WP-CLI" --post_status=submit
You’ll additionally upload content material to the publish, assign an writer, set the submit date, and extra via the use of the correct flags.
Extra details about the wp publish create command will also be discovered within the WP-CLI documentation.
Should you’re beginning a brand new website and need to populate it with placeholder content material, then the wp publish generate command will turn out to be useful.
This command is deal for growing take a look at content material for a brand new website design or populating a website with hundreds of posts to check efficiency.
It creates a couple of posts with a unmarried command.

Like with different instructions, you’ll upload flags to the wp publish generate command.
wp publish generate --count=10
Different flags that can be utilized with wp publish generate come with: –post_type=, –post_status=, –-post_author=, and –post_date=.
For instance:
wp publish generate --count=10 --post_type=web page --post_status=draft --post_author=1 --post_date="2025-01-15 12:15:00"
The above command will create 10 draft pages via the writer with ID 1 with the introduction date and time set to January 15, 2025, 12:15 pm.
You’ll to find out extra concerning the wp publish generate command within the WordPress Developer Manual.
You’ll additionally replace or trade current posts the use of WP-CLI.
The wp publish replace command flags assist you to replace the identify, frame, excerpt, submit date, popularity, and writer.
As you’ll replace a couple of posts immediately, this command turns out to be useful for converting the popularity for a couple of posts from revealed to draft or assigning a special person because the writer.
When updating a couple of posts with a unmarried command, you will have to consult with the posts the use of their ID. To peer the IDs for every publish, use this command:
wp publish checklist
After you have the IDs for every publish you wish to have to replace, you’ll consult with them within the command, separated via an area.
Right here’s an instance of a wp publish replace command that updates a couple of posts:
wp publish replace 1 125 283 --post_author=2
This command adjustments the writer of the posts with IDs 1, 125, and 283 to the person with ID 2.

(To view the checklist of customers and their IDs, use the wp person checklist command.)
To construct upon that command, when you sought after to trade the writer of all posts via a particular writer to another writer, it’s good to use this command:
wp publish replace $(wp publish checklist --author=1 --format=ids) --post_author=2

This command retrieves a listing of all posts authored via the writer with writer ID 1, then updates or adjustments them in order that the writer is now the only with ID 2.
You must use the similar technique to trade the popularity of all revealed posts to draft via the use of this command:
wp publish replace $(wp publish checklist --post_status=submit --format=ids) --post_status=draft
You’ll see what else is conceivable with this command at the wp publish replace web page of the WP-CLI documentation.
Deleting posts is any other process that you’ll perform with WP-CLI.
Once more, the publish IDs are used when specifying which publish(s) to delete:
wp publish delete 649

To delete a couple of posts, separate the IDs with an area:
wp publish delete 649 300 150
By means of default, posts are moved to the trash. Alternatively, you’ll use the –power flag to skip the trash folder and delete the publish:
wp publish delete 648 --force
If you wish to delete all pages, you’ll use the next command:
wp publish delete $(wp publish checklist --post_type=web page --format=ids)

This command deletes all posts via a particular person:
wp publish delete $(wp publish checklist --post_author=2 --format=ids)

The wp theme instructions additionally assist you to perform a number of theme-related duties on a website.
To temporarily view a listing of all subject matters at the website, together with their popularity, whether or not an replace is to be had, and the model quantity, input the next command:
wp theme checklist

You’ll switch on a particular put in theme the use of the next command:
wp theme switch on twentytwenty

Like plugins, you’ll set up subject matters from the command line.
If you wish to set up a theme from the WordPress Theme Listing, you’ll want to use its slug.
Like plugins, the slug is within the URL of the theme’s web page within the WordPress Theme Listing.
For instance, if you wish to set up the Hi Biz theme, you wish to have to go into its identify as hello-biz in keeping with its slug.
wp theme set up hello-biz

If you wish to switch on the theme after putting in it, upload the –switch on flag:
wp theme set up hello-biz --activate
A unmarried command can replace all the subject matters that experience an to be had replace:
wp theme replace --all
You’ll additionally exclude subject matters from the replace via the use of the –exclude flag:
wp theme replace --all --exclude=twentytwenty
But even so, the wp remark command provides you with a snappy technique to view and delete unsolicited mail feedback at the website, in addition to have interaction with feedback in alternative ways.
You’ll see the feedback on a website via the use of the next command:
wp remark checklist
Alternatively, this doesn’t at all times come with unsolicited mail feedback within the checklist. To peer unsolicited mail feedback, use this command:
wp remark checklist --status=unsolicited mail
Then, to delete the unsolicited mail feedback, use the wp remark delete command with the wp remark checklist command:
wp remark delete $(wp remark checklist --status=unsolicited mail --format=ids)
The above are only a few examples of the way you’ll use WP-CLI to have interaction together with your WordPress website out of doors of the WP Admin interface.
Optimistically, this has impressed you to start out interacting with WordPress from the command line.
For more info on the use of WP-CLI, take a look at the whole checklist of instructions within the documentation.
WP-CLI is integrated with the WordPress.com Industry and Trade webhosting plans.
Some core instructions aren’t supported, however there are a couple of others which can be unique to WordPress.com websites.
To peer precisely what’s to be had at the WordPress.com Industry and Trade webhosting plans, input the next command:
wp --help
Doing so will divulge all the WP-CLI instructions to be had in your website in keeping with your plan.
wpcomsh is a WordPress.com-specific command that comes with a number of helpful subcommands for managing your website.
One such command is wp wpcomsh diag.
This command runs website diagnostics checks and outputs the effects, together with the popularity of plugins, accounts with administrator get right of entry to, main points of lively WordPress.com webhosting plans and services and products, important PHP mistakes, and extra.
It’s a snappy and simple technique to get an in depth review of a website’s popularity.
The wp wpcomsh plugin command allows you to transfer between the use of the WordPress.com-optimized model of a plugin and the usual WordPress.org model.
For instance, when you use the command:
wp wpcomsh plugin use-managed woocommerce
The website will get started the use of the WordPress.com-optimized model of the WooCommerce plugin relatively than the model to be had from the WordPress.org Plugin Listing.
Chances are you’ll need to use this command when you’re putting in a brand new website that must be similar to an current website and is the use of a particular model of a plugin.
If there are mistakes at the website, the next command disables all plugins and allows them separately to test if a particular plugin is inflicting the problem:
wp wpcomsh plugin-dance
You’ll additionally organize Jetpack and WooCommerce by means of WP-CLI.
For extra WordPress.com-specific WP-CLI instructions, take a look at the whole checklist within the WordPress.com Developer documentation.
As you’ll see, having the ability to use WP-CLI is one more reason why WordPress.com isn’t only for webhosting easy blogs; it’s a developer-friendly platform with complicated tooling.
There’s much more you’ll do with WP-CLI, from trying out the entire checklist of instructions to making your individual customized instructions.
You’ll additionally create Bash scripts that comprise a couple of WP-CLI instructions. Then, as an alternative of working every command for my part, you’ll run all the script immediately.
For instance, it’s good to create a Bash script known as replace.sh that comes with WP-CLI instructions to replace all plugins and subject matters:
wp plugin replace --all
wp theme replace --all
You’ll then run the script with ./replace.sh. The script’s contents will execute, which on this case, will replace the topics and plugins at the website.
That’s only a pattern of what’s conceivable with WP-CLI. To be told extra, consult with the net manual.
WP-CLI is a useful gizmo for builders and website homeowners who need extra keep an eye on over their website whilst spending much less time clicking round in WP Admin.
The most important hurdle to getting began is in most cases a psychological one.
Most often, opening your terminal instrument and logging in for the primary time takes only some mins. After that, you’ll have a quicker, extra environment friendly technique to organize your website.
Past its pace and potency, WP-CLI gives different sensible benefits.
You’ll deactivate plugins and subject matters, toggle settings when WP Admin is inaccessible, or even generate dummy content material with a unmarried command.
To take a look at it out, join the Industry or Trade plan on WordPress.com.
Any other great tool to discover is WordPress Studio, a loose open-source desktop app from WordPress.com for development native WordPress websites. Along with letting you spin up websites in seconds, sync with WordPress.com or Pressable, and import any WordPress website to paintings on in the neighborhood, it provides you with a snappy, simple method to check out out WP-CLI in a secure atmosphere.
August used to be a large month for WordPress. WordPress 7 ...
August 14 – 27, 2026 Welcome again to the WordPr ...
You'll now set up your WordPress.com web page from Ch ...
Lifetime Membership with Unlimited Access