From 616eb91d957ef8d10f99db6a960cafd1cc6fc699 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 2 Dec 2013 18:45:28 +0000 Subject: [PATCH] Themes: Always include the current theme in the list, even if it is not allowed. see #25948. git-svn-id: https://develop.svn.wordpress.org/trunk@26529 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/theme.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/includes/theme.php b/src/wp-admin/includes/theme.php index 9ae4fe5f74..e3ef308aa4 100644 --- a/src/wp-admin/includes/theme.php +++ b/src/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, ), );