Skip to content

Update WordPress via WP-CLI on cPanel: verify-checksums first, then update

Update WordPress with WP-CLI on cPanel safely by running verify-checksums before you change anything, then updating core, the database, plugins and themes in that order. A tested restore point and a second checksum pass afterwards give you evidence that the site came through intact.

If you update WordPress sites on cPanel with WP-CLI, which runs WordPress admin tasks from the shell, this procedure keeps each update safe and checkable. It works the same for one site or a whole fleet. The risky moment is not the update command itself. It comes later, when you find an odd file in wp-admin/ and cannot tell whether the update left it there or it was already present.

So check file integrity first. Run wp core verify-checksums before you change anything. It compares your files with the hashes (file fingerprints) that WordPress.org publishes for each release. Then take a backup you have restored at least once, update core, run the database migration, update plugins and themes, and repeat the checks before a final render test. One limit shapes the whole procedure. These checks cover WordPress core and anything installed from the WordPress.org directory, and nothing else, so premium plugins and custom themes cannot be verified this way.

What you’ll accomplish

  • Establish a signed baseline of the install before the update, so any file that appears later has a known origin.
  • Know exactly which PHP binary WP-CLI is using on a cPanel account, and why it often is not the one MultiPHP shows in the interface.
  • Produce a restore point you have proven restorable, rather than a backup you hope works.
  • Run core, database migration, plugins and themes in the order that does not leave a half-migrated schema behind.
  • Re-verify integrity and prove the site renders, so you can answer “did that update break anything” with evidence rather than a shrug.

Prerequisites

You need shell access to the cPanel account — either SSH as the account user, or Terminal in cPanel if your host has enabled it. Root or reseller access on WHM is required only for the fleet loop at the end; everything else runs as the unprivileged account user, and that is deliberate.

WP-CLI 2.5 or later is assumed. wp plugin verify-checksums and wp theme verify-checksums both need WP-CLI 2.x; the theme command is the newer of the two, so on very old bundled builds it may be missing entirely. Check with wp cli version before you plan a procedure around it.

--include-root on wp core verify-checksums is a WP-CLI flag rather than a WordPress feature, so it depends on your WP-CLI build, not on the site’s WordPress version. The site’s database user in wp-config.php must have privileges to alter tables, or wp core update-db will fail partway. On cPanel that is normally true, but it is not true on a site whose credentials were narrowed by a previous “hardening” pass.

One honest version note: cPanel servers frequently run several PHP builds side by side under /opt/cpanel/ea-php##/. WP-CLI does not read the account’s MultiPHP setting. It runs under whichever php resolves first in the shell PATH, which on many cPanel builds is the system PHP, not the site’s. Everything in the next section depends on getting that right.

How it works

wp core update does not patch files in place. It downloads a release archive from WordPress.org, unpacks it over wp-admin/ and wp-includes/, replaces the root PHP files, and then deletes files that the release manifest says no longer belong. It leaves wp-content/ alone. That is why a core update never touches your plugins or uploads, and also why a backdoor dropped inside wp-content/uploads/ survives every core update you will ever run.

The checksum commands work off a separate, public API. For core, WordPress.org publishes an MD5 for every file in every released version and locale. wp core verify-checksums fetches the manifest for your exact version and locale, hashes your files, and reports three classes of problem: a file whose hash differs, a file the manifest expects that is missing, and — with --include-root — a file present in the docroot that the manifest never mentions. That third class is how injected backdoors surface. An attacker who adds wp-admin/css/colors/blue/wp-load.php has not modified any file WordPress ships, so a naive “diff against a fresh download” misses it; the checksum command names it explicitly as a file that should not exist.

For plugins and themes, the same idea applies but the source is the .org directory’s per-release checksum files. If a plugin came from the directory and is at a released version, its files are verifiable. If it is a premium plugin, a client’s custom theme, or something a developer edited in place, there is no published manifest and the command simply reports it as unverifiable rather than clean. This is the part people misread most often, and it is the reason a green run is not a clean bill of health.

Coverage boundary of WP-CLI verify-checksums, showing core and .org directory files as verifiable and premium, must-use, uploads and config files as unverifiable

Running the verification first also changes what the result means. Before the update, an unexpected file is evidence about the state of the site as it has been running. After the update, it could equally be a leftover from a plugin that writes into core directories, a partial unpack, or an attacker. Sequence is what makes the signal readable.

Step-by-step

The full sequence, with the point at which each gate stops the run:

Eight-stage WordPress update pipeline showing verify, restore point, core, update-db, plugins, themes, re-verify and render check, with the failure that halts each stage

  1. Confirm which PHP WP-CLI is actually using. This is the pre-flight step that saves the most time on cPanel, because php -v in the shell and the account’s MultiPHP version routinely disagree.

    wp cli info

    The output names the binary and version WP-CLI will run under:

    PHP binary:     /opt/cpanel/ea-php81/root/usr/bin/php
    PHP version:    8.1.27
    php.ini used:   /opt/cpanel/ea-php81/root/etc/php.ini
    WP-CLI version: 2.10.0

    If that version is older than the version the site is served with, pin WP-CLI to the right binary for the session rather than fighting PATH:

    alias wp='/opt/cpanel/ea-php82/root/usr/bin/php /usr/local/bin/wp'

    Re-run wp cli info and confirm the PHP version now matches the account’s MultiPHP setting.

  2. Confirm you are the account user, not root. Files created by root inside a cPanel docroot are the kind of problem that surfaces two weeks later as a plugin that cannot write its cache.

    whoami
    wp option get siteurl

    Expect the account username and the site’s canonical URL:

    acmecorp
    https://example.com

    If wp refuses to run because it detects root, the correct fix is to drop to the account user with su -l acmecorp, not to add --allow-root.

  3. Confirm the docroot and check headroom. An addon domain or a subdirectory install means the docroot is not ~/public_html. Point WP-CLI at it explicitly with --path rather than guessing.

    wp --path=/home/acmecorp/public_html core version
    df -h /home
    quota -s

    A core download needs room for the archive, the unpacked copy and the old files at once. If the account is within a few hundred megabytes of its quota, clear space first — a failed unpack partway through is the worst state to land in.

  4. Take the integrity baseline. This is the gate, and it runs before anything is written.

    wp core verify-checksums --include-root
    wp plugin verify-checksums --all
    wp theme verify-checksums --all

    A clean install answers:

    Success: WordPress installs verify against checksums.
    Success: Verified 24 of 24 plugins.
    Success: Verified 3 of 3 themes.

    Anything else stops the run. A modified core file is worth investigating; a file reported as one that should not exist under wp-admin/ or wp-includes/ is a strong indicator of an injected file, and the update is not the priority any more — see the Japanese keyword hack cleanup for what that investigation looks like. Note also that the plugin and theme counts will be lower than your installed counts if some are premium; that is expected, not a failure.

  5. Take a restore point you have tested. cPanel’s own backup facility is fine for the nightly safety net, but mid-procedure you want something you control, that lands in a path you chose, and that you can restore in one command without opening a ticket.

    wp db export ~/pre-update-$(date +%F-%H%M).sql
    tar -czf ~/pre-update-files-$(date +%F-%H%M).tar.gz -C ~/public_html .

    Expected:

    Success: Exported to '/home/acmecorp/pre-update-2026-09-05-0930.sql'.

    An untested backup is not a restore point. Prove the dump is loadable before you rely on it — import it into a scratch database once, or at minimum confirm it is complete and non-truncated:

    tail -n 1 ~/pre-update-$(date +%F-%H%M).sql

    A complete mysqldump ends with a -- Dump completed line. If it ends mid-statement, the export was cut short and you do not have a restore point.

  6. Update core. Check what is on offer first, then take it.

    wp core check-update
    wp core update

    The success path is unambiguous:

    Updating to version 6.6.2 (en_US)...
    Downloading update from https://downloads.wordpress.org/release/wordpress-6.6.2-no-content.zip...
    Unpacking the update...
    Success: WordPress updated successfully.

    To take only the current branch’s security release rather than a major version, use wp core update --minor. Anything non-zero here means you restore rather than retry — a second attempt over a half-unpacked tree is how sites end up with mismatched core files.

  7. Run the schema migration. This is the step that gets skipped, and skipping it produces the “site works until it doesn’t” class of bug: new code running against an old schema, fine on cached pages, failing the first time something writes.

    wp core update-db
    Success: WordPress database upgraded successfully from db version 57155 to 58975.

    If the site is multisite, add --network so every subsite migrates rather than only the main one.

  8. Update plugins, dry run first. Read the dry-run output rather than skimming it; a plugin jumping a major version is where breaking changes live.

    wp plugin update --all --dry-run
    wp plugin update --all

    The dry run lists each plugin with its current and available version and updates nothing. The real run ends with a table and a count:

    Success: Updated 6 of 6 plugins.
  9. Update themes. Same pattern, and the same reason to read the output.

    wp theme update --all --dry-run
    wp theme update --all
    Success: Updated 2 of 2 themes.

    A child theme is not updated by this and should not be — that is your code. If the parent theme jumped a major version, the child’s template overrides are the first thing to check in step 10.

Validate it works

Re-run the same three checksum commands you ran in step 4 and compare the results, not just the exit status:

wp core verify-checksums --include-root
wp plugin verify-checksums --all
wp theme verify-checksums --all

The expected answer is the same three success lines. A file that failed verification before the update and still fails is an unresolved question. A file that verified before and fails now was changed by the update process, and if the release notes do not explain it, stop.

Then prove the site actually renders, from outside the server:

curl -o /dev/null -s -w '%{http_code} %{time_total}s\n' https://example.com/
curl -o /dev/null -s -w '%{http_code}\n' https://example.com/wp-login.php
wp option get home
wp db check
200 0.412s
200
https://example.com
Success: Database checked.

A 200 on the home page is the floor, not the finish line. Load one page that exercises the database on write — a search results page, a logged-in dashboard, a cart if the site sells anything. And confirm no maintenance flag was orphaned:

wp maintenance-mode status
Maintenance mode is not active.

Troubleshooting

wp cli info shows a different PHP version than the site runs. WP-CLI reads PATH, not the account’s MultiPHP setting. Invoke it through the intended binary explicitly, as in step 1. Running an update under PHP 7.4 for a site served by PHP 8.2 will usually still write correct files, but any plugin activation hook that runs during the update executes under the wrong runtime, and the failures are confusing.

Root-owned files after an update. Someone ran WP-CLI as root with --allow-root. The site then fails on the next legitimate write — plugin installs, media uploads, cache regeneration. Fix ownership and stop doing it:

chown -R acmecorp:acmecorp /home/acmecorp/public_html

verify-checksums reports a file that should not exist, and it is yours. Some caching and security plugins legitimately write into core directories — an advanced-cache drop-in, for instance. Confirm the file’s origin before treating it as an intrusion, but confirm it rather than assuming it. If you cannot attribute it to an installed plugin, treat it as hostile.

The update leaves .maintenance behind. A killed process during the unpack can strand the flag file, and the site serves the maintenance page indefinitely. Clear it:

wp maintenance-mode deactivate
rm -f ~/public_html/.maintenance

A plugin fatals after the update. Deactivate the specific plugin rather than rolling the whole site back, then decide. Reinstalling the previous version restores the files but does not undo a database migration the new version already ran; if the plugin migrated its own tables, restoring the database dump from step 5 is the only actual rollback. Fleet-wide, the plugins most likely to do this are the abandoned ones — the abandoned-plugin fleet audit is the standing version of that check.

To pin core back to a known version after a failed major update:

wp core update --version=6.5.5 --force
wp db import ~/pre-update-2026-09-05-0930.sql

--force is required because the installed version is higher than the requested one. Restore the database in the same motion — core downgrades without a matching database are their own outage.

Running it across a fleet

From WHM or root, iterate accounts by dropping to each user rather than running WP-CLI as root. The loop below finds every account with a WordPress install and takes the integrity baseline; the same shape works for the update itself once you trust the baseline.

for user in $(ls /var/cpanel/users); do
  home=$(getent passwd "$user" | cut -d: -f6)
  [ -f "$home/public_html/wp-config.php" ] || continue
  echo "=== $user ==="
  su -l "$user" -c "wp --path=$home/public_html core verify-checksums --include-root" || true
done

The || true keeps one failing account from ending the sweep — you want the whole inventory, then a triage pass, not a run that stops on the first surprise. Capture the output to a file and diff it against last week’s; on a fleet, the change between runs is more informative than any single run.

When this is the wrong approach

If the site is a client’s production storefront and you have no staging copy, do not run a major-version core update straight through this procedure at all. The procedure makes the update defensible; it does not make an untested major upgrade safe. Clone to staging, run it there, then run it here.

If the install is managed by Composer or deployed from git, wp core update is the wrong tool entirely — it will write files your deployment pipeline does not know about, and the next deploy will silently revert them. Update the dependency in the repository instead.

And if verify-checksums fails at step 4, this is not an update procedure any more. Updating a compromised install overwrites some of your evidence and none of the attacker’s persistence, which usually lives in wp-content/, the database options table, or a cron entry the update does not touch. Contain first.

Reference material worth keeping open: the WP-CLI command documentation for exact flag behaviour per version, and cPanel’s documentation for MultiPHP and account-level shell specifics.

Running WordPress that earns real money deserves an operator — Stack Harbor runs that stack under Enterprise WordPress; book an infrastructure consult.