WP-CLI is the free, official command-line interface for WordPress.
It has no API key, no tiers, no per-unit pricing and no rate limits, because it runs on your server and uses the site's own access rather than a vendor's gateway, which also means it slots easily into schedulers and Activepieces flows that already run on your own infrastructure.
Everything here comes from wp-cli.org, checked on 2026-12-06.
Understand WP-CLI as command-line tool
What WP-CLI does
If you would rather skip the admin screen, WP-CLI lets you manage a WordPress site from a terminal instead. You can update core, install and activate plugins, create users, search and replace in the database, and export content, all as commands.

WP-CLI limits and cost trade-offs
The trade-off is that it has no hosted endpoint. It won't answer a request from another machine, and it doesn't sign anyone in over the network. Your limits are those of the server: its CPU, its memory and how many jobs you run at once.
| Where it runs | How it authenticates | Cost model | Rate limits | |
|---|---|---|---|---|
| WP-CLI | On the WordPress server | The server user's own access to the site | Free | None set by the tool; server resources only |
| WordPress REST API | Over HTTP, on the site | Credentials sent with each request, such as application passwords or cookies | Included with WordPress | Whatever your host or security plugins impose |
| Hosted automation service | On the vendor's cloud | Connection you grant to the site | Set by the vendor's plan | Set by the vendor's plan |
When you want the REST API instead
Choose the REST API when the caller is not on the server. That means a separate application, a browser front end, or a service in another location that needs to read or write site data over HTTP.
It's built into WordPress, so it needs no installation, but every request must carry credentials and can be filtered by your host.
If it must reach in from outside, the REST API is the right door, and Activepieces, whose MIT-licensed core has 25,885 GitHub stars you can read the source behind, can sit on top of it.
Everything below works on Activepieces' free plan. Start without code or a credit card.
Install WP-CLI on macOS, Linux and Windows
Install WP-CLI on the machine that holds the WordPress files, because it runs there and borrows the site's own access instead of knocking from outside like the REST API.
On macOS, Homebrew is the shortest route:
brew install wp-cli
On Linux, download the phar, confirm PHP can run it, make it executable, then move it onto your PATH as wp:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
On shared hosting without sudo, put the file in a directory you own and add that directory to PATH instead.
Windows install
On Windows, the handbook treats the environment as more limited than Unix-like systems. The route I'd take is Windows Subsystem for Linux: open a Linux shell and follow the Linux steps exactly.
Verify the WP-CLI install with wp --info
Run this in a new terminal:
wp --info
When the install is healthy, it prints the PHP binary in use, the PHP version, the WP-CLI version and the directory it will read config from.
If it reports "command not found", the file isn't on your PATH, so fix that before doing anything else.
How WP-CLI connects to a WordPress site
There is no login, no API key and no token. WP-CLI runs as whichever server user you are, loads WordPress from a directory on disk, and inherits whatever that site is already allowed to do.

Run WP-CLI as the right user
Whoever you are logged in as is who WP-CLI acts as, so the account matters.
If you run it as root, WP-CLI refuses and warns you, because a root-run command can create files the web server user then can't write to, such as cache or upload directories.

Run commands as the account that owns the site's files. On a typical server that is the web user or a dedicated site user:
sudo -u www-data -- wp core version
Swap www-data for your site's actual owner. Only use --allow-root in a throwaway container where file ownership doesn't matter.
Target a site with WP-CLI --path and --url
Start in the current directory or anywhere above WordPress and WP-CLI finds it on its own. If you are elsewhere, --path names the folder that holds wp-config.php.
On a multisite install, or any setup where several domains share one codebase, --url selects which site the command applies to.
wp --path=/var/www/example.com/public_html --url=https://example.com option get siteurl
If you must act as a particular WordPress account, --user sets it by ID, login or email. Without it, commands run with no logged-in user, which is fine for reading options and wrong for anything that checks capabilities.

Wp-cli.yml and environment variables
Put flags in a wp-cli.yml file in the project root:
path: public_html
url: https://example.com
When settings conflict, the order is fixed: flags typed on the command line win, then wp-cli.local.yml, then the project wp-cli.yml, then the user-level file at ~/.wp-cli/config.yml. Variables use the WP_CLI_ prefix, for example WP_CLI_PATH.
Run WP-CLI on remote sites over SSH
You don't need to log in first. --ssh runs the command on another host, and aliases in wp-cli.yml give each site a short name:
@production:
ssh: [email protected]/var/www/example.com/public_html
url: https://example.com
wp @production core version
To confirm everything is wired up, run these two. Each should print a real value, not an error:
wp core version
wp option get siteurl
Run WP-CLI's ten most-used commands
Four of the ten commands that cover most day-to-day WordPress work change or erase data, so run wp db export before any of those. Check the table for what each command is for and which ones can't be undone.
| Command | Purpose | Destructive |
|---|---|---|
wp core update |
Update WordPress itself | Yes |
wp plugin install / update |
Add or upgrade plugins | Yes, on update |
wp theme list |
Show installed themes | No |
wp user create |
Add an account | No |
wp post create |
Add a post | No |
wp db export |
Dump the database to a file | No |
wp search-replace |
Rewrite strings in the database | Yes |
wp cache flush |
Clear the object cache | No, but cached data is lost |
wp cron event run |
Fire scheduled events now | Depends on the event |
wp option get / update |
Read or change a setting | Yes, on update |
wp db export backup.sql
wp core update
wp plugin list
wp plugin install akismet --activate
wp plugin update --all
wp theme list
wp user create editor1 [email protected] --role=editor
wp post create --post_title="Release notes" --post_status=draft
Publishing posts, or reacting when new content lands somewhere else, is the one job here that doesn't need the server's shell.
Activepieces has a WordPress integration for it, and you can read its source in the MIT-licensed core: it is one of the 751 integrations in the open source monorepo under the packages/pieces/community directory, where roughly 60% are community-contributed.
Core updates, wp search-replace and anything touching the database stay with WP-CLI.
wp search-replace 'http://old.example' 'https://new.example' --dry-run
wp search-replace 'http://old.example' 'https://new.example'
Run with --dry-run and it reports what would change without writing anything. Skip it and the replacement is permanent, which is why the export comes first.
wp cache flush
wp cron event run --due-now
wp option get blogname
wp option update blogname "New name"
Flushing the cache is recoverable because it rebuilds itself. option update overwrites the stored value, so note the old one with option get first.
Easier to see it running than to read about it: set it up free, no card.
Fix common WP-CLI production errors
When WP-CLI fails, seven causes account for most of it, each with a recognisable message and a short fix, and the table below maps one to the other.
The wording of messages can shift between releases, so match on the gist rather than the exact string.
| Message | Cause | Fix |
|---|---|---|
This does not seem to be a WordPress installation. |
WP-CLI is running from a directory with no wp-config.php above it |
Pass --path=/full/path/to/site, or cd into the site first |
Error establishing a database connection |
Wrong credentials or host in wp-config.php, or the database server is down |
Check the DB_* constants and confirm the database service is running |
Allowed memory size ... exhausted |
The CLI's PHP memory limit is too low for the job | Run with php -d memory_limit=512M $(which wp) ... or raise WP_CLI_PHP_ARGS |
YIKES! It looks like you're running this as root. |
WP-CLI refuses root by default because it loads site code | Run as the site's file owner, for example sudo -u www-data wp ... |
| Syntax errors or version-related fatals | The CLI's PHP binary differs from the web server's | Run wp --info and call the matching PHP binary explicitly |
| White screen or fatal from a plugin or theme | Broken code loads on every command | Add --skip-plugins or --skip-themes |
| Command stops partway on a large job | A time or resource limit on the host or shell session | Batch the work, or run it under screen, tmux or nohup |
WP-CLI path, user and database errors
When you see "not a WordPress installation", it almost always means the wrong working directory, so set --path explicitly in scripts rather than relying on where the job starts.
On the database error, the fault is the site's own: WP-CLI reads the same credentials the web server does, so if the site is down, so is the command.
On root, you can override with --allow-root, but the safer fix is running as the correct user.
WP-CLI memory and PHP version problems
A site can run fine in the browser and still exhaust memory in a bulk import, because the command line often uses a different php.ini from the web server.
WP-CLI errors from broken plugins and themes
When a plugin throws a fatal error on load, every WP-CLI command goes down with it, including the ones you need to deactivate it.
Add --skip-plugins to bypass all plugins, or --skip-plugins=plugin-name for one, then run wp plugin deactivate plugin-name. --skip-themes does the same for the active theme. Skipping plugins also skips any commands those plugins register.
WP-CLI timeouts on large jobs
A timeout on a long job usually comes from your SSH session dropping or a host-level cap, because WP-CLI itself doesn't impose the web server's execution limit.
Process large sets in batches, and start long runs inside tmux or screen so a lost connection doesn't kill them.
Run WP-CLI in cron and CI, and where Activepieces fits
Schedule WP-CLI from system cron or a CI runner, and give every job an absolute --path, because a scheduled shell has no working directory to guess from.
Run WP-CLI in system cron and CI
When a job starts under cron, the environment is minimal: a short PATH, no login profile, often a different user from the one you tested as. A command that works in your terminal can fail silently there.

The list below shows what a job has to state for itself, and the failures it prevents.
- An absolute
--pathto the WordPress root, so the job doesn't depend on the current directory. - The full path to the
wpbinary, since cron'sPATHmay not include it. - The right system user, so files it writes aren't owned by root.
- Output redirected to a log file, or failures vanish.
- The CLI PHP version, which can differ from the one the web server runs.
Separately, WordPress's own scheduler fires only when a page is requested. To run it from the system clock, set DISABLE_WP_CRON to true in wp-config.php and call wp cron event run --due-now from real cron every few minutes.
When a no-code workflow is enough
If a job starts from an event rather than a server, Activepieces has a WordPress integration that suits it: creating a post when a form is submitted, say.
On Activepieces' pricing page, Free is listed at $0 per month, Plus at $20 and Team at $200.
Those tiers step up with monthly credits, so a workflow that fires on every submission has a cost that grows with traffic. WP-CLI in cron costs nothing per run.
It doesn't replace WP-CLI for core updates, database work or anything that needs the server's filesystem. Use the integration for form-to-post jobs, and cron for the rest.
Frequently asked questions
Is WP-CLI free?
Yes, WP-CLI is free, open-source software with no API key, no tier and no per-command charge.
The only costs are the ones you already pay for: the server it runs on and the hosting plan that gives you shell access. If a vendor quotes you a price for "WP-CLI access," you're paying for the hosting feature, not the tool.
Does WP-CLI work on shared hosting?
It works on shared hosting only if your plan includes SSH access and a command-line PHP. Many hosts preinstall it, so check by running wp --info after you log in.
If the host offers no shell, there's nothing to run the tool in, and no setting inside WordPress will change that. Check your plan's feature list before you budget time for automation.

Is WP-CLI the same as the WordPress REST API?
No. The REST API is a set of HTTP endpoints that remote clients call with credentials.
Running on the server itself, WP-CLI loads WordPress directly, using the site's own access instead of a token you issue. That's why it needs no authentication setup, and why it can't be called from a machine that has no shell on the server.
For a remote service that has to reach your site over the network, the REST API remains the interface built for it.
To update WP-CLI itself, run wp cli update. To see whether a newer release exists before you commit, run wp cli check-update.
If your host installed WP-CLI in a location your account can't write to, the update will fail with a permissions error. You'll need the host to update it, or a copy you install in your own directory.
Can you run WP-CLI on Windows without WSL? Not reliably. The project's documentation treats Windows as having limited support, and WSL, the Linux environment built into Windows, is the safer route.
Some commands lean on tools that behave differently outside a Unix-style shell, so a native setup can work for simple tasks and then fail on the first command that shells out.



