WordPress

Update your theme with WP-CLI

Theme updates are as quick as plugin updates with WP-CLI — but there's a trap: custom edits to the theme. Here's how to update without losing them.

Themes update just like plugins with WP-CLI. The difference is the risk: if someone edited the theme directly, an update can overwrite those changes. Here’s how to update safely.

List your themes

wp theme list                       # all themes + status
wp theme list --update=available    # only those with an update

The status column shows which theme is active, and update shows whether a newer version exists.

Update the theme

wp theme update twentytwentyfour    # one theme
wp theme update --all               # all themes
wp theme update --all --dry-run     # show first, change nothing

Switch the active theme

Want to activate a different theme, or install a new one? One command does it.

wp theme activate my-theme
wp theme install twentytwentyfive --activate

The trap: custom edits in the theme

If someone edited the theme’s files directly, an update overwrites them. That’s why customizations belong in a child theme or a plugin — never in the parent theme itself. Not sure the theme is untouched? Run the update on a staging copy first and compare.

  • Using a block theme (FSE)? Templates and styles you changed in the editor live in the database, not the theme files — they survive an update.
  • Have a custom theme? Then there’s usually no update to run — which is one of the points of building your own.

Verify afterwards

Reload the site and click through a few templates (homepage, post, archive). If something looks wrong you can roll back from your backup — always take a wp db export before major theme updates, just like with plugins in part three.

The full WP-CLI series

Rather not do it yourself? At Kepler, WP-CLI and SSH access are part of Managed WordPress — we keep core, themes and plugins updated for you. And you can always SSH into your own cloud server and run the commands above whenever you like.

Bygg på ett moln du faktiskt äger.

Ingen bindningstid. En körande VM innan du betalar en krona.