diff -r 48c4eec2b7e6 -r 8c2e4d02f4ef wp/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php --- a/wp/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php Fri Sep 05 18:40:08 2025 +0200 +++ b/wp/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php Fri Sep 05 18:52:52 2025 +0200 @@ -201,7 +201,7 @@ $current_theme = wp_get_theme(); $status = $request['status']; - foreach ( $active_themes as $theme_name => $theme ) { + foreach ( $active_themes as $theme ) { $theme_status = ( $this->is_same_theme( $theme, $current_theme ) ) ? 'active' : 'inactive'; if ( is_array( $status ) && ! in_array( $theme_status, $status, true ) ) { continue; @@ -348,6 +348,19 @@ } } + if ( rest_is_field_included( 'default_template_types', $fields ) && $this->is_same_theme( $theme, $current_theme ) ) { + $default_template_types = array(); + foreach ( get_default_block_template_types() as $slug => $template_type ) { + $template_type['slug'] = (string) $slug; + $default_template_types[] = $template_type; + } + $data['default_template_types'] = $default_template_types; + } + + if ( rest_is_field_included( 'default_template_part_areas', $fields ) && $this->is_same_theme( $theme, $current_theme ) ) { + $data['default_template_part_areas'] = get_allowed_block_template_part_areas(); + } + $data = $this->add_additional_fields_to_object( $data, $request ); // Wrap the data in a response object. @@ -459,29 +472,29 @@ 'title' => 'theme', 'type' => 'object', 'properties' => array( - 'stylesheet' => array( + 'stylesheet' => array( 'description' => __( 'The theme\'s stylesheet. This uniquely identifies the theme.' ), 'type' => 'string', 'readonly' => true, ), - 'stylesheet_uri' => array( + 'stylesheet_uri' => array( 'description' => __( 'The uri for the theme\'s stylesheet directory.' ), 'type' => 'string', 'format' => 'uri', 'readonly' => true, ), - 'template' => array( + 'template' => array( 'description' => __( 'The theme\'s template. If this is a child theme, this refers to the parent theme, otherwise this is the same as the theme\'s stylesheet.' ), 'type' => 'string', 'readonly' => true, ), - 'template_uri' => array( + 'template_uri' => array( 'description' => __( 'The uri for the theme\'s template directory. If this is a child theme, this refers to the parent theme, otherwise this is the same as the theme\'s stylesheet directory.' ), 'type' => 'string', 'format' => 'uri', 'readonly' => true, ), - 'author' => array( + 'author' => array( 'description' => __( 'The theme author.' ), 'type' => 'object', 'readonly' => true, @@ -496,7 +509,7 @@ ), ), ), - 'author_uri' => array( + 'author_uri' => array( 'description' => __( 'The website of the theme author.' ), 'type' => 'object', 'readonly' => true, @@ -513,7 +526,7 @@ ), ), ), - 'description' => array( + 'description' => array( 'description' => __( 'A description of the theme.' ), 'type' => 'object', 'readonly' => true, @@ -528,12 +541,12 @@ ), ), ), - 'is_block_theme' => array( + 'is_block_theme' => array( 'description' => __( 'Whether the theme is a block-based theme.' ), 'type' => 'boolean', 'readonly' => true, ), - 'name' => array( + 'name' => array( 'description' => __( 'The name of the theme.' ), 'type' => 'object', 'readonly' => true, @@ -548,23 +561,23 @@ ), ), ), - 'requires_php' => array( + 'requires_php' => array( 'description' => __( 'The minimum PHP version required for the theme to work.' ), 'type' => 'string', 'readonly' => true, ), - 'requires_wp' => array( + 'requires_wp' => array( 'description' => __( 'The minimum WordPress version required for the theme to work.' ), 'type' => 'string', 'readonly' => true, ), - 'screenshot' => array( + 'screenshot' => array( 'description' => __( 'The theme\'s screenshot URL.' ), 'type' => 'string', 'format' => 'uri', 'readonly' => true, ), - 'tags' => array( + 'tags' => array( 'description' => __( 'Tags indicating styles and features of the theme.' ), 'type' => 'object', 'readonly' => true, @@ -582,18 +595,18 @@ ), ), ), - 'textdomain' => array( + 'textdomain' => array( 'description' => __( 'The theme\'s text domain.' ), 'type' => 'string', 'readonly' => true, ), - 'theme_supports' => array( + 'theme_supports' => array( 'description' => __( 'Features supported by this theme.' ), 'type' => 'object', 'readonly' => true, 'properties' => array(), ), - 'theme_uri' => array( + 'theme_uri' => array( 'description' => __( 'The URI of the theme\'s webpage.' ), 'type' => 'object', 'readonly' => true, @@ -610,16 +623,60 @@ ), ), ), - 'version' => array( + 'version' => array( 'description' => __( 'The theme\'s current version.' ), 'type' => 'string', 'readonly' => true, ), - 'status' => array( + 'status' => array( 'description' => __( 'A named status for the theme.' ), 'type' => 'string', 'enum' => array( 'inactive', 'active' ), ), + 'default_template_types' => array( + 'description' => __( 'A list of default template types.' ), + 'type' => 'array', + 'readonly' => true, + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'slug' => array( + 'type' => 'string', + ), + 'title' => array( + 'type' => 'string', + ), + 'description' => array( + 'type' => 'string', + ), + ), + ), + ), + 'default_template_part_areas' => array( + 'description' => __( 'A list of allowed area values for template parts.' ), + 'type' => 'array', + 'readonly' => true, + 'items' => array( + 'type' => 'object', + 'properties' => array( + 'area' => array( + 'type' => 'string', + ), + 'label' => array( + 'type' => 'string', + ), + 'description' => array( + 'type' => 'string', + ), + 'icon' => array( + 'type' => 'string', + ), + 'area_tag' => array( + 'type' => 'string', + ), + ), + ), + ), ), );