diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index 7863ba23c7..d88d1f5d60 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -2916,7 +2916,9 @@ function debug_fclose( $fp ) { * broken, if it is missing style.css; index.php is optional. * * @since 1.5.0 - * @global array $wp_themes Stores the working themes. + * @deprecated 3.4.0 + * @deprecated Use wp_get_themes() + * @see wp_get_themes() * * @return array Theme list with theme data. */ @@ -2941,6 +2943,9 @@ function get_themes() { * Retrieve theme data. * * @since 1.5.0 + * @deprecated 3.4.0 + * @deprecated Use wp_get_theme() + * @see wp_get_theme() * * @param string $theme Theme name. * @return array|null Null, if theme name does not exist. Theme data, if exists. @@ -2950,6 +2955,25 @@ function get_theme( $theme ) { $themes = get_themes(); if ( is_array( $themes ) && array_key_exists( $theme, $themes ) ) - return $themes[$theme]; + return $themes[ $theme ]; return null; +} + +/** + * Retrieve current theme name. + * + * @since 1.5.0 + * @deprecated 3.4.0 + * @deprecated Use (string) wp_get_theme() + * @see wp_get_theme() + * + * @return string + */ +function get_current_theme() { + _deprecated_function( __FUNCTION__, '3.4', 'get_current_theme()' ); + + if ( $theme = get_option( 'current_theme' ) ) + return $theme; + + return wp_get_theme()->get('Name'); } \ No newline at end of file diff --git a/wp-includes/theme.php b/wp-includes/theme.php index f124d13e21..dbe9671fd5 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -356,24 +356,6 @@ function get_theme_roots() { return $theme_roots; } -/** - * Retrieve current theme display name. - * - * If the 'current_theme' option has already been set, then it will be returned - * instead. If it is not set, then each theme will be iterated over until both - * the current stylesheet and current template name. - * - * @since 1.5.0 - * - * @return string - */ -function get_current_theme() { - if ( $theme = get_option( 'current_theme' ) ) - return $theme; - - return wp_get_theme()->get('Name'); -} - /** * Register a directory that contains themes. * @@ -791,7 +773,9 @@ function validate_current_theme() { function get_theme_mods() { $theme_slug = get_option( 'stylesheet' ); if ( false === ( $mods = get_option( "theme_mods_$theme_slug" ) ) ) { - $theme_name = get_current_theme(); + $theme_name = get_option( 'current_theme' ); + if ( false === $theme_name ) + $theme_name = wp_get_theme()->get('Name'); $mods = get_option( "mods_$theme_name" ); // Deprecated location. if ( is_admin() && false !== $mods ) { update_option( "theme_mods_$theme_slug", $mods ); @@ -878,7 +862,12 @@ function remove_theme_mod( $name ) { */ function remove_theme_mods() { delete_option( 'theme_mods_' . get_option( 'stylesheet' ) ); - delete_option( 'mods_' . get_current_theme() ); + + // Old style. + $theme_name = get_option( 'current_theme' ); + if ( false === $theme_name ) + $theme_name = wp_get_theme()->get('Name'); + delete_option( 'mods_' . $theme_name ); } /**