diff --git a/wp-admin/site-editor.php b/wp-admin/site-editor.php index d2880b0a4f..a8b43b52af 100644 --- a/wp-admin/site-editor.php +++ b/wp-admin/site-editor.php @@ -101,7 +101,7 @@ if ( isset( $_GET['postType'] ) && ! isset( $_GET['postId'] ) ) { } $active_global_styles_id = WP_Theme_JSON_Resolver::get_user_global_styles_post_id(); -$active_theme = wp_get_theme()->get_stylesheet(); +$active_theme = get_stylesheet(); $preload_paths = array( array( '/wp/v2/media', 'OPTIONS' ), '/wp/v2/types?context=view', diff --git a/wp-includes/block-template-utils.php b/wp-includes/block-template-utils.php index 802627873e..8ecb9dfe55 100644 --- a/wp-includes/block-template-utils.php +++ b/wp-includes/block-template-utils.php @@ -437,7 +437,7 @@ function _inject_theme_attribute_in_block_template_content( $template_content ) 'core/template-part' === $block['blockName'] && ! isset( $block['attrs']['theme'] ) ) { - $block['attrs']['theme'] = wp_get_theme()->get_stylesheet(); + $block['attrs']['theme'] = get_stylesheet(); $has_updated_content = true; } } @@ -499,7 +499,7 @@ function _remove_theme_attribute_in_block_template_content( $template_content ) function _build_block_template_result_from_file( $template_file, $template_type ) { $default_template_types = get_default_block_template_types(); $template_content = file_get_contents( $template_file['path'] ); - $theme = wp_get_theme()->get_stylesheet(); + $theme = get_stylesheet(); $template = new WP_Block_Template(); $template->id = $theme . '//' . $template_file['slug']; @@ -710,7 +710,7 @@ function _build_block_template_result_from_post( $post ) { $theme = $terms[0]->name; $template_file = _get_block_template_file( $post->post_type, $post->post_name ); - $has_theme_file = wp_get_theme()->get_stylesheet() === $theme && null !== $template_file; + $has_theme_file = get_stylesheet() === $theme && null !== $template_file; $origin = get_post_meta( $post->ID, 'origin', true ); $is_wp_suggestion = get_post_meta( $post->ID, 'is_wp_suggestion', true ); @@ -907,7 +907,7 @@ function get_block_templates( $query = array(), $template_type = 'wp_template' ) array( 'taxonomy' => 'wp_theme', 'field' => 'name', - 'terms' => wp_get_theme()->get_stylesheet(), + 'terms' => get_stylesheet(), ), ), ); @@ -973,7 +973,7 @@ function get_block_templates( $query = array(), $template_type = 'wp_template' ) } $is_not_custom = false === array_search( - wp_get_theme()->get_stylesheet() . '//' . $template_file['slug'], + get_stylesheet() . '//' . $template_file['slug'], wp_list_pluck( $query_result, 'id' ), true ); @@ -1114,7 +1114,7 @@ function get_block_file_template( $id, $template_type = 'wp_template' ) { } list( $theme, $slug ) = $parts; - if ( wp_get_theme()->get_stylesheet() !== $theme ) { + if ( get_stylesheet() !== $theme ) { /** This filter is documented in wp-includes/block-template-utils.php */ return apply_filters( 'get_block_file_template', null, $id, $template_type ); } diff --git a/wp-includes/block-template.php b/wp-includes/block-template.php index 38d8e2b729..19f3b5fb14 100644 --- a/wp-includes/block-template.php +++ b/wp-includes/block-template.php @@ -145,7 +145,7 @@ function resolve_block_template( $template_type, $template_hierarchy, $fallback_ // Find all potential templates 'wp_template' post matching the hierarchy. $query = array( - 'theme' => wp_get_theme()->get_stylesheet(), + 'theme' => get_stylesheet(), 'slug__in' => $slugs, ); $templates = get_block_templates( $query ); diff --git a/wp-includes/blocks/template-part.php b/wp-includes/blocks/template-part.php index bef49341d7..3837a0a17d 100644 --- a/wp-includes/blocks/template-part.php +++ b/wp-includes/blocks/template-part.php @@ -22,7 +22,7 @@ function render_block_core_template_part( $attributes ) { if ( isset( $attributes['slug'] ) && isset( $attributes['theme'] ) && - wp_get_theme()->get_stylesheet() === $attributes['theme'] + get_stylesheet() === $attributes['theme'] ) { $template_part_id = $attributes['theme'] . '//' . $attributes['slug']; $template_part_query = new WP_Query( diff --git a/wp-includes/class-wp-theme-json-resolver.php b/wp-includes/class-wp-theme-json-resolver.php index c166283af3..40bc7ab98a 100644 --- a/wp-includes/class-wp-theme-json-resolver.php +++ b/wp-includes/class-wp-theme-json-resolver.php @@ -243,13 +243,14 @@ class WP_Theme_JSON_Resolver { _deprecated_argument( __METHOD__, '5.9.0' ); } - $options = wp_parse_args( $options, array( 'with_supports' => true ) ); + $options = wp_parse_args( $options, array( 'with_supports' => true ) ); if ( null === static::$theme || ! static::has_same_registered_blocks( 'theme' ) ) { $theme_json_file = static::get_file_path_from_theme( 'theme.json' ); + $wp_theme = wp_get_theme(); if ( '' !== $theme_json_file ) { $theme_json_data = static::read_json_file( $theme_json_file ); - $theme_json_data = static::translate( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) ); + $theme_json_data = static::translate( $theme_json_data, $wp_theme->get( 'TextDomain' ) ); } else { $theme_json_data = array(); } @@ -265,12 +266,12 @@ class WP_Theme_JSON_Resolver { $theme_json_data = $theme_json->get_data(); static::$theme = new WP_Theme_JSON( $theme_json_data ); - if ( wp_get_theme()->parent() ) { + if ( $wp_theme->parent() ) { // Get parent theme.json. $parent_theme_json_file = static::get_file_path_from_theme( 'theme.json', true ); if ( '' !== $parent_theme_json_file ) { $parent_theme_json_data = static::read_json_file( $parent_theme_json_file ); - $parent_theme_json_data = static::translate( $parent_theme_json_data, wp_get_theme()->parent()->get( 'TextDomain' ) ); + $parent_theme_json_data = static::translate( $parent_theme_json_data, $wp_theme->parent()->get( 'TextDomain' ) ); $parent_theme = new WP_Theme_JSON( $parent_theme_json_data ); /* diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php index f1a9d2482a..9ce931398f 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php @@ -564,7 +564,7 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller { * @return WP_REST_Response|WP_Error */ public function get_theme_item( $request ) { - if ( wp_get_theme()->get_stylesheet() !== $request['stylesheet'] ) { + if ( get_stylesheet() !== $request['stylesheet'] ) { // This endpoint only supports the active theme for now. return new WP_Error( 'rest_theme_not_found', @@ -638,7 +638,7 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller { * @return WP_REST_Response|WP_Error */ public function get_theme_items( $request ) { - if ( wp_get_theme()->get_stylesheet() !== $request['stylesheet'] ) { + if ( get_stylesheet() !== $request['stylesheet'] ) { // This endpoint only supports the active theme for now. return new WP_Error( 'rest_theme_not_found', diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php index 8f70cda9f1..49e5c8d829 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php @@ -528,7 +528,7 @@ class WP_REST_Templates_Controller extends WP_REST_Controller { $changes->post_type = $this->post_type; $changes->post_status = 'publish'; $changes->tax_input = array( - 'wp_theme' => isset( $request['theme'] ) ? $request['theme'] : wp_get_theme()->get_stylesheet(), + 'wp_theme' => isset( $request['theme'] ) ? $request['theme'] : get_stylesheet(), ); } elseif ( 'custom' !== $template->source ) { $changes->post_name = $template->slug; diff --git a/wp-includes/theme-templates.php b/wp-includes/theme-templates.php index 16bd5e2d77..7ef010eea5 100644 --- a/wp-includes/theme-templates.php +++ b/wp-includes/theme-templates.php @@ -27,7 +27,7 @@ function wp_set_unique_slug_on_create_template_part( $post_id ) { $terms = get_the_terms( $post_id, 'wp_theme' ); if ( ! is_array( $terms ) || ! count( $terms ) ) { - wp_set_post_terms( $post_id, wp_get_theme()->get_stylesheet(), 'wp_theme' ); + wp_set_post_terms( $post_id, get_stylesheet(), 'wp_theme' ); } } @@ -60,7 +60,7 @@ function wp_filter_wp_template_unique_post_slug( $override_slug, $slug, $post_ID * in the case of new entities since is too early in the process to have been saved * to the entity. So for now we use the currently activated theme for creation. */ - $theme = wp_get_theme()->get_stylesheet(); + $theme = get_stylesheet(); $terms = get_the_terms( $post_ID, 'wp_theme' ); if ( $terms && ! is_wp_error( $terms ) ) { $theme = $terms[0]->name; diff --git a/wp-includes/version.php b/wp-includes/version.php index e913c9792d..fcdc7dd2d0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-54815'; +$wp_version = '6.2-alpha-54817'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.