I’ve been updating several of my themes to support the new custom logo feature that is being introduced in WordPress 4.5 (read about it here).
Most of my themes already had a logo option, so part of adding support for this new feature has been to build an update script to migrate the previously saved value (generally saved to the theme mod “logo”), to the new theme mod “custom_logo”.
I assume a lot of other theme authors will also be doing this, so I’m sharing my update code in case it can save someone a few minutes.
A few things to note:
- You’ll likely need to tweak it to match your current theme_mod/setting for the logo.
- I saved my logo value as a URL, so this script converts it to an attachment ID before saving it into the new theme_mod
If you see any improvements that can be made, feel free to edit the Gist!