diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index 9ae4fe5f74..e3ef308aa4 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -376,13 +376,16 @@ function themes_api( $action, $args = null ) { * @return array An associative array of theme data, sorted by name. */ function wp_prepare_themes_for_js( $themes = null ) { - if ( null === $themes ) { - $themes = wp_get_themes( array( 'allowed' => true ) ); - } - $prepared_themes = array(); $current_theme = get_stylesheet(); + if ( null === $themes ) { + $themes = wp_get_themes( array( 'allowed' => true ) ); + if ( ! isset( $themes[ $current_theme ] ) ) { + $themes[ $current_theme ] = wp_get_theme(); + } + } + $updates = array(); if ( current_user_can( 'update_themes' ) ) { $updates_transient = get_site_transient( 'update_themes' ); @@ -415,7 +418,7 @@ function wp_prepare_themes_for_js( $themes = null ) { 'update' => get_theme_update_available( $theme ), 'actions' => array( 'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null, - 'customize'=> current_user_can( 'edit_theme_options' ) ? admin_url( 'customize.php?theme=' . $encoded_slug ) : null, + 'customize'=> current_user_can( 'edit_theme_options' ) ? wp_customize_url( $slug ) : null, 'delete' => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null, ), );