WP-CLI 3.0: Update Safely Before Your Scripts Break
WP-CLI 3.0 needs PHP 7.2.24+, a --major flag and changes old commands. Back up, update with the right flag, test, and fix scripts that use removed items.
The short answer
WP-CLI 3.0.0, released on 1 December 2026, requires PHP 7.2.24 or newer and only crosses from version 2 when you run wp cli update --major. Back up the database and the WP-CLI file first, then test a few basic commands. Finally, fix scripts that use wp plugin status, wp theme status, the old skip prompt variable or rely on unlimited memory.
Reading options
On this page
- What is WP-CLI, in plain words?
- Before you start
- Updating WP-CLI 3.0 step by step
- Fix scripts that used removed or renamed items
- Variants: phar, Composer and cPanel
- How to check it worked
- Troubleshooting
- Pro tips and when to ask for help
- The one message worth forwarding
- Reader questions
- Sources & further reading
WP-CLI 3.0.0 came out on 1 December 2026, and it is a major release with real breaking changes. Before you update, check your PHP version, back up the site and the WP-CLI file itself, then search your scripts for a short list of removed or renamed items. Most sites will update in a few minutes, but a nightly script that quietly relies on an old command can fail without anyone noticing.
Here is the part that surprises people: WP-CLI 3.0 needs PHP 7.2.24 or newer, and it no longer sets PHP's memory limit to unlimited for you. So a script that ran fine for years on version 2 can stop with a memory error on version 3, even though you changed nothing in the script.
By the end of this guide you will know which version you run, how to update to 3.0 with the right flag, how to test it, and how to fix the old commands that break.
What is WP-CLI, in plain words?
WP-CLI is the command line tool for WordPress. Instead of clicking through the dashboard, you type a command over SSH (a secure text connection to your server) and WordPress does the job.
Think of it as the remote control for your site. The dashboard is the buttons on the TV itself, and WP-CLI is the remote you can program to press buttons for you at 2 a.m.
That is why this update matters. Many people never type WP-CLI commands by hand. A cron job (a task the server runs on a timer) calls a script every night, and if 3.0 changes a command inside it, nobody is watching when it breaks.
Before you start
Run through this checklist first.
- Access: SSH access to your server, or a terminal inside your hosting panel. In cPanel, open the Terminal tool in your cPanel (your host may name it differently). It only appears if your host has enabled shell access for your account.
- Tools: WP-CLI already installed, and the ability to run
phpfrom the same terminal. - Backup: a fresh database export and a copy of the site files, plus a copy of the current WP-CLI file so you can roll back. Step 2 shows how.
- Time: about 20 to 30 minutes for one site, more if you have many scripts to read.
- Risk level: low for the update itself, medium for your scripts. Updating WP-CLI does not change WordPress, but scripts that use removed commands will start failing or acting differently.
Heads up: if your server runs PHP older than 7.2.24, stop here. WP-CLI 3.0 dropped support for PHP 5.6 to 7.2.23, so you need a PHP upgrade first, which is a bigger job.
Updating WP-CLI 3.0 step by step
Step 1: Check your current versions
Log in over SSH or open the cPanel Terminal. Then go to the folder where WordPress lives. For our made-up example site, that is the public_html folder of the account that hosts example.com.
This command moves you into the WordPress folder:
cd ~/public_htmlThis command prints full details about your WP-CLI setup, including the PHP it uses:
wp cli infoYou should see lines such as PHP binary, PHP version, PHP memory limit, php.ini used and WP-CLI version. Older versions may show fewer lines, which is fine.
This command prints only the WP-CLI version number:
wp cli versionYou will see one line such as WP-CLI 2.12.0 (a made-up example number for our example site). Write your real number down.
This command shows which PHP your terminal uses:
php --versionWhy this matters: the PHP version in wp cli info is the one that counts, because the plain php command may point to a different PHP. If it shows 7.2.24 or newer, move on. WP-CLI 3.0 is compatible up to PHP 8.5.
Step 2: Back up the site and the WP-CLI binary
Before any risky step, back up. Here there are two things to save: the site, and WP-CLI itself.
This command exports the WordPress database to a .sql file in the current folder:
wp db export ~/example-com-before-wpcli3.sqlYou should see a line that starts with Success: Exported to. Move that file outside the public web folder and make sure your file backup is current. For a full plan, follow our guide on backing up a cPanel site with an offsite copy and a test restore.
Next, find where the WP-CLI file lives. This command prints its path:
which wpOn a server set up with the official guide, you will usually see /usr/local/bin/wp. Now copy that file to your home folder so you can roll back in seconds.
This command copies the current WP-CLI file to a backup name in your home folder:
cp "$(which wp)" ~/wp-cli-2-backup.pharQuick tip: the official install guide sets WP-CLI up as one phar file (a packed PHP program), so copying that file is a full backup. Composer installs differ; see the variants section.
Step 3: Read the breaking changes that hit scripts
The official release notes list the changes. These are the ones most likely to touch a site owner's scripts:
- PHP 7.2.24 or newer is required.
wp cli updateno longer jumps across major versions unless you pass--major.- Self-updates now require SHA-512 checksum verification, and the old MD5 check is gone.
- WP-CLI no longer forces PHP's
memory_limitto-1(unlimited). wp plugin updateandwp theme updateskip plugins and themes managed by Git, Subversion or Mercurial unless you override it.wp plugin statusandwp theme statusare deprecated. Uselistorgetinstead.- The environment variable
WP_CLI_SKIP_PROMPTis renamed toWP_CLI_ERROR_RERUN. - The default
--contextis nowauto, which picksadminorclidepending on the command. wp search-replacenow unserializes stored data with onlystdClassobjects allowed by default.
A checksum is a fingerprint of a file, and SHA-512 is a far stronger fingerprint than MD5. The search-replace change blocks PHP object injection, a way attackers abuse stored data; we cover it in the fix section.
Step 4: Check that 3.0 is offered to you
This command asks GitHub which WP-CLI updates are available for your copy:
wp cli check-updateIf you are already current, you will see Success: WP-CLI is at the latest version. Otherwise you get a small table with columns such as version, update_type and package_url.
This command shows only major version updates, which is where 3.0.0 appears if you are on version 2:
wp cli check-update --majorHeads up: the check uses the GitHub API, which allows 60 unauthenticated requests per hour per IP address. On shared hosting, neighbours on the same IP can use that up. A GITHUB_TOKEN environment variable raises the limit to 5,000 per hour.
Step 5: Update with the right flag
By default, updates stay within your current major version. A plain wp cli update only tells you a new major exists and points you to --major.
This command updates WP-CLI across the major version boundary from 2.x to 3.0:
wp cli update --majorYou should see a prompt like You have version 2.12.0. Would you like to update to 3.0.0? [y/n]. Type y. The run should end with Success: Updated WP-CLI to 3.0.0.
If the WP-CLI file is owned by root, the official install guide says to run the update with sudo.
This command runs the same update with root rights, for a file in /usr/local/bin:
sudo wp cli update --majorThe other update flags from the official docs, in short:
--patchand--minorlimit the update to patch or minor releases.--stableinstalls the latest stable release and skips the availability check.--nightlyinstalls the latest build of the main branch, which can be unstable and only works for the phar install.--yesskips the confirmation prompt, which is useful inside an automated script.
Step 6: Test a short script
Now prove that the basics work on version 3.0 before your nightly jobs run. Do these by hand, one at a time.
This command confirms the WP-CLI version is now 3.0.0:
wp cli versionYou should see WP-CLI 3.0.0.
This command prints the WordPress version, which proves WP-CLI can load your site:
wp core versionYou should see one version number and nothing else. An error here usually points to PHP or memory trouble, covered in troubleshooting below.
This command lists your plugins with their status, version and update state:
wp plugin listYou should see a table with the columns name, status, update, version, update_version and auto_update.
This command previews a search and replace without saving anything to the database:
wp search-replace 'http://example.com' 'https://example.com' --dry-runThe --dry-run flag runs the whole operation and shows a report, but does not save changes. You should see a table of tables and how many replacements would happen. That proves search-replace still reads your data under the new, stricter unserialize rule.
If these four commands work, WP-CLI itself is healthy. Anything that still fails is in your own scripts.
Fix scripts that used removed or renamed items
Find the risky lines
First, find every script that calls WP-CLI. Common places are your home folder, a bin or scripts folder, and your cron jobs. This command prints your account's cron jobs so you can see which scripts run on a timer:
crontab -lThis command searches your home folder for scripts that use the items changed in 3.0:
grep -rnE "plugin status|theme status|WP_CLI_SKIP_PROMPT|search-replace|cli update" ~/ --include="*.sh"Each match shows the file name, the line number and the line. If your scripts do not end in .sh, remove the --include part, but expect a slower search.
Here is a made-up example. Imagine example.com has a nightly script that runs wp plugin status and emails the output to the owner. On 3.0 that command is deprecated, so the email may change shape or show a warning. The website is fine, but the daily report quietly stops making sense.
Replace plugin status and theme status
The release notes say to use list or get instead. This command lists all plugins, which replaces the plain wp plugin status:
wp plugin listThis command shows the details of one plugin, which replaces wp plugin status akismet:
wp plugin get akismetBy default wp plugin get shows name, title, author, version, description and status. For themes, use wp theme list and wp theme get the same way.
Quick tip: if a script reads the output, ask for a stable format. This command prints active plugins as JSON, which is easier for a script to read than a table:
wp plugin list --status=active --format=jsonRename the old skip prompt variable
If any script or crontab line sets WP_CLI_SKIP_PROMPT, change the name to WP_CLI_ERROR_RERUN. The release notes list this as a plain rename, so keep the same value you used before.
This command shows any crontab lines that still use the old name:
crontab -l | grep WP_CLI_SKIP_PROMPTNo output means you are clear.
Check the search-replace behaviour
In 3.0, wp search-replace unserializes stored data with allowed_classes set to only stdClass. Serialized data is how PHP stores arrays and objects as text in the database; plain arrays are not affected.
If a plugin stores its own PHP objects in the database, those objects are no longer rebuilt during the replace. The release notes say there is a filter hook to allow custom classes, but they do not name it. If your dry run reports fewer replacements than you expected on a plugin's data, ask that plugin's developer before you run it for real.
Check for Git, SVN or Mercurial managed plugins
Version 3.0 skips version controlled plugins and themes during wp plugin update and wp theme update. That protects your developer's code, but a script that expects every plugin to update will now leave some behind.
Each system leaves a hidden folder: Git uses .git, Subversion uses .svn, and Mercurial uses .hg. This command finds those folders inside your plugins and themes:
find wp-content/plugins wp-content/themes -maxdepth 2 -type d \( -name .git -o -name .svn -o -name .hg \)Run it from the WordPress folder. Each line it prints, such as wp-content/plugins/my-custom-plugin/.git, points to a plugin or theme that 3.0 will treat as version controlled. This is a quick manual check. The release notes do not describe the exact rule WP-CLI uses, so treat the result as a strong hint.
The command docs for wp plugin update list an --include-vcs flag to include these plugins. At the time of writing (3 December 2026), that docs page still marks the flag as not yet in a stable release. Check whether your installed version has it before you put it in a script.
This command shows the full help for wp plugin update on your own server, including every flag your version supports:
wp help plugin updateIf --include-vcs is not listed, leave those plugins to whoever manages the repository.
Variants: phar, Composer and cPanel
WP-CLI installed as a phar file
This is the setup from the official install guide, and the steps above cover it. If you run WP-CLI as php wp-cli.phar from your home folder instead of a wp command, use the same commands with that prefix, for example php wp-cli.phar cli update --major.
WP-CLI installed with Composer
Composer is a PHP package manager. The official install guide says a global Composer install is updated with composer global update.
This command updates a global Composer install of the WP-CLI bundle:
composer global updateHeads up: in 3.0, the wp-cli/package-command part moved to require-dev in wp-cli/wp-cli-bundle. The release notes say Composer installs that use wp package should require it directly. Phar users still get wp package by default.
cPanel Terminal
On cPanel, everything above runs inside the Terminal tool in your cPanel (your host may name it differently). You will not have sudo there. If which wp points to a system folder you cannot write to, your host installed WP-CLI for everyone and controls its version, so ask them when they plan to move to 3.0.
How to check it worked
Run these checks after the update and again after the next scheduled run of your scripts.
wp cli versionprintsWP-CLI 3.0.0.wp cli check-updateprintsSuccess: WP-CLI is at the latest version.wp cli infoshows a PHP version of 7.2.24 or newer and no warning about a low memory limit orulimit -v.wp core versionprints your WordPress version with no errors.- The
grepsearch from the fix section returns no lines forplugin status,theme statusorWP_CLI_SKIP_PROMPT. - The next morning, the log or email from your nightly script looks the same as before the update.
Troubleshooting
PHP Fatal error: Allowed memory size exhausted
Likely cause: WP-CLI 3.0 no longer sets memory_limit to unlimited, so your PHP command line limit now applies. Fix for one run: the WP-CLI handbook shows starting WP-CLI through PHP with a higher limit.
This command runs one WP-CLI command with a 512 MB memory limit:
php -d memory_limit=512M "$(which wp)" plugin listFor a permanent fix, find the php.ini your command line uses with php -i | grep php.ini and set memory_limit = 512M in that file. If wp cli info also warns about ulimit -v, the limit is set by the operating system, and on shared hosting only your host can change it.
"A new major version (3.0.0) is available" but nothing updates
Likely cause: you ran plain wp cli update, which stays inside your current major version. Fix: run wp cli update --major as shown in Step 5.
The check-update or update fails after a few tries
Likely cause: the GitHub API limit of 60 unauthenticated requests per hour per IP address, which other accounts on a shared IP can use up. Fix: wait an hour, or create a GitHub personal access token with public read access and set it as GITHUB_TOKEN for that one command, for example GITHUB_TOKEN=your_token_here wp cli check-update.
Some plugins no longer update in your script
Likely cause: those plugins sit in a Git, SVN or Mercurial folder, and 3.0 skips them by default. Fix: run the find command from the fix section to see which ones, then either update them through their repository or use --include-vcs if wp help plugin update lists it on your version.
Error: YIKES! It looks like you're running this as root.
Likely cause: you ran a site command with sudo or as the root user. The WP-CLI handbook says running WP-CLI as root is extremely dangerous and strongly discourages it. Fix: run site commands as the normal account that owns the WordPress files, and keep sudo for updating the WP-CLI file itself.
WP-CLI will not start after the update and you need it back today
Likely cause: an old PHP version or a server limit you cannot fix right away. Fix: put your backup file back. This command restores the version 2 file you saved in Step 2:
sudo cp ~/wp-cli-2-backup.phar /usr/local/bin/wpRun wp cli version to confirm, then plan the fix before trying again.
Pro tips and when to ask for help
- Pin your scripts to clear output. Use
--format=jsonor--field=nameso a future change in table layout does not break your parsing. - If you also run WordPress auto-updates, keep them separate from WP-CLI changes. Our guide to a safe backup plan for WordPress auto-updates covers that side.
- While you are checking server versions, it is a good time to confirm your database server version too. Our WordPress MySQL version check walks through it.
Ask your host when which wp points to a system folder you cannot change, when ulimit -v is low, or when PHP on the command line is older than 7.2.24. Ask a developer when a plugin stores custom PHP objects and your search-replace dry run looks wrong, or when version controlled plugins need updating.
The one message worth forwarding
If someone else manages your server or scripts, send them this:
"Hi, WP-CLI 3.0.0 was released on 1 December 2026. Before we update, can you confirm our command line PHP is 7.2.24 or newer, back up the site and the current WP-CLI file, and then update with wp cli update --major? Please also check our scripts for wp plugin status, wp theme status, WP_CLI_SKIP_PROMPT and any wp search-replace runs, and tell me if any plugins are managed in Git, since 3.0 skips those during updates. Thanks."
The takeaway: WP-CLI 3.0 is a safe update when you back up first and fix the few old commands your scripts still use.
Reader questions
Will updating WP-CLI change my WordPress site?
No. Updating WP-CLI replaces the command line tool only, not WordPress core, plugins or themes. Your scripts that call WP-CLI are what may behave differently.
Why does wp cli update say I am at the latest version when 3.0 exists?
By default wp cli update stays inside your current major version. Run wp cli update --major to move from 2.x to 3.0.
Can I run WP-CLI 3.0 on PHP 7.1?
No. WP-CLI 3.0 requires PHP 7.2.24 or newer and dropped support for PHP 5.6 to 7.2.23. Upgrade the command line PHP first or stay on version 2 for now.
Does WP-CLI 3.0 work with PHP 8.5?
Yes. The release notes describe full compatibility up through PHP 8.5.
How do I go back to WP-CLI 2 if something breaks?
If you copied the old phar file before updating, copy it back over the wp file, for example with sudo cp ~/wp-cli-2-backup.phar /usr/local/bin/wp. Then run wp cli version to confirm.
What should I use instead of wp plugin status?
Use wp plugin list for all plugins or wp plugin get with a plugin name for one plugin. For themes, use wp theme list and wp theme get.
Is it safe to use --nightly on a live site?
The official docs say nightly builds are potentially unstable and suit development or staging, not production. It also only works with the phar install.
Was this guide helpful?
Help us make the next update better.
Sources & further reading
Originally published . About our editorial updates.



