Customizer Settings in Arrays

The get_theme_mod() function works the following:

  • It fetches the get_theme_mods() function under the hood.
  • This returns the following data

    $theme_slug = get_option( 'stylesheet' );
    get_option( "theme_mods_{$theme_slug}" );
    

So in case you upgrade, write an upgrade function specific for that version of your plugin or theme, that uses one of the following, where the name is fetched via get_option( 'stylesheet' ); again:

  • delete_option( "mods_{$theme_name}" );
  • update_option( "theme_mods_{$theme_slug}", $mods );