Updating a WordPress theme from the shell is useful during remote maintenance windows, scripted release work, or hosts where wp-admin access is limited. Running the update through WP-CLI keeps the change explicit and makes it easy to inspect the pending version before replacing theme files.

The wp theme update command downloads the current package for a theme slug and replaces the installed copy inside /wp-content/themes/. Pairing it with wp theme list exposes the installed version, whether an update is available, and which slug should be updated, which is safer than guessing from the theme's display name in the dashboard.

Updating the active theme changes live templates, styles, and bundled assets immediately, and any direct edits inside the parent theme directory are overwritten by the new package. The safest path is to run the command from the document root that contains /wp-config.php/, preview the update first, and keep a rollback point when production traffic depends on that theme.

Steps to update a WordPress theme with WP-CLI:

  1. Change into the exact WordPress document root.
    $ cd /var/www/example.com/public_html
  2. Confirm that WP-CLI is targeting the expected site and identify the theme slug that actually has an update available.
    $ wp option get home
    https://www.example.com
    
    $ wp theme list --fields=name,status,version,update,update_version
    +-------------------+----------+---------+-----------+----------------+
    | name              | status   | version | update    | update_version |
    +-------------------+----------+---------+-----------+----------------+
    | twentytwentyfive  | active   | 1.4     | none      |                |
    | twentytwentyfour  | inactive | 1.0     | available | 1.4            |
    | twentytwentythree | inactive | 1.6     | none      |                |
    +-------------------+----------+---------+-----------+----------------+

    Copy the exact slug from the name column instead of updating by the theme's display title.

  3. Archive the current theme directory before replacing it, and take a full site backup first when the active theme is being changed on production.
    $ mkdir -p ~/backups/wordpress
    $ tar -czf ~/backups/wordpress/twentytwentyfour-pre-update.tar.gz wp-content/themes/twentytwentyfour

    Direct edits inside the parent theme directory will be overwritten by the update. Keep custom code in a child theme or in version control instead of relying on the packaged theme directory as the source of truth.

  4. Preview the pending update before making the write.
    $ wp theme update twentytwentyfour --dry-run
    Available theme updates:
    +------------------+----------+---------+----------------+
    | name             | status   | version | update_version |
    +------------------+----------+---------+----------------+
    | twentytwentyfour | inactive | 1.0     | 1.4            |
    +------------------+----------+---------+----------------+

    The –dry-run preview is the fastest way to confirm the slug and target version before the theme directory is replaced.

  5. Update the theme by slug.
    $ wp theme update twentytwentyfour
    Downloading update from https://downloads.wordpress.org/theme/twentytwentyfour.1.4.zip...
    Unpacking the update...
    Installing the latest version...
    Removing the old version of the theme...
    Theme updated successfully.
    +------------------+-------------+-------------+---------+
    | name             | old_version | new_version | status  |
    +------------------+-------------+-------------+---------+
    | twentytwentyfour | 1.0         | 1.4         | Updated |
    +------------------+-------------+-------------+---------+
    Success: Updated 1 of 1 themes.

    If the updated theme is active, re-test the home page and at least one template-specific URL immediately after the command finishes.

  6. Verify that the theme now reports the expected version and no longer shows an available update.
    $ wp theme list --name=twentytwentyfour --fields=name,status,version,update
    +------------------+----------+---------+--------+
    | name             | status   | version | update |
    +------------------+----------+---------+--------+
    | twentytwentyfour | inactive | 1.4     | none   |
    +------------------+----------+---------+--------+

    An update value of none confirms that WP-CLI no longer sees a newer package for that slug.