Make WordPress Core


Ignore:
Timestamp:
06/20/2023 10:15:57 PM (18 months ago)
Author:
audrasjb
Message:

REST API: Indicate when a theme supports the Site editor in the Themes REST API response.

This changeset adds a is_block_theme property to each theme in the wp/v2/themes API response, which uses WP_Theme::is_block_theme to determinate whether
the theme is block theme or not.

Props grantmkin, ironprogrammer, zunaid321, azaozz, spacedmonkey, audrasjb, costdev.
Fixes #58123.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php

    r53760 r55951  
    327327        }
    328328
     329        if ( rest_is_field_included( 'is_block_theme', $fields ) ) {
     330            $data['is_block_theme'] = $theme->is_block_theme();
     331        }
     332
    329333        $data = $this->add_additional_fields_to_object( $data, $request );
    330334
     
    495499                    ),
    496500                ),
     501                'is_block_theme' => array(
     502                    'description' => __( 'Whether the theme is a block-based theme.' ),
     503                    'type'        => 'boolean',
     504                    'readonly'    => true,
     505                ),
    497506                'name'           => array(
    498507                    'description' => __( 'The name of the theme.' ),
Note: See TracChangeset for help on using the changeset viewer.