how to test a theme upgrade

You are asking two questions. The one being how can you test an update and the other being how can you run code after an update.

You can test a theme update by pushing the updates out your self and testing it if it works. You can do that by using GitHub Updater.

If you want to run code only after a upgrade there is no core solution. There are two ways it could work.

  1. You save the theme version to the database as with this you can calculate what version or update it is and then run the update code.
  2. If you are including new options in the update you could check if the new options exist yet and if not then run the update code.

I think the after_setup_theme should be fine.

Leave a Comment