diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 2d13952a42..5ff47c4998 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -3202,7 +3202,7 @@ } // Prevent loading a non-active theme preview when there is a drafted/scheduled changeset. - if ( panel.canSwitchTheme( slug ) ) { + if ( ! panel.canSwitchTheme( slug ) ) { deferred.reject({ errorCode: 'theme_switch_unavailable' }); @@ -3299,7 +3299,10 @@ // Prevent loading a non-active theme preview when there is a drafted/scheduled changeset. if ( ! panel.canSwitchTheme( themeId ) ) { - return deferred.reject().promise(); + deferred.reject({ + errorCode: 'theme_switch_unavailable' + }); + return deferred.promise(); } urlParser = document.createElement( 'a' ); diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php index 607349b04a..bb4aafb0b7 100644 --- a/src/wp-includes/class-wp-customize-manager.php +++ b/src/wp-includes/class-wp-customize-manager.php @@ -5446,7 +5446,12 @@ final class WP_Customize_Manager { $theme->id = $theme->slug; $theme->screenshot = array( $theme->screenshot_url ); $theme->authorAndUri = $theme->author; - $theme->parent = ( $theme->slug === $theme->template ) ? false : $theme->template; // The .org API does not seem to return the parent in a documented way; however, this check should yield a similar result in most cases. + // The .org API can return the full parent theme details if passed the 'parent' arg, or if passed the 'template' option it'll return that in the event it's a child theme. + if ( isset( $theme->parent ) ) { + $theme->parent = $theme->parent['slug']; + } else { + $theme->parent = false; + } unset( $theme->slug ); unset( $theme->screenshot_url ); unset( $theme->author );