Make WordPress Core

Opened 16 months ago

Last modified 15 months ago

#63299 assigned enhancement

WP_Theme: Add "has_theme_json" method

Reported by: wildworks Owned by: wildworks
Priority: normal Milestone: Awaiting Review
Component: Themes Version:
Severity: normal Keywords:
Cc: Focuses:

Description

We plan to expose the has_theme_json field in the Theme Rest API in #63253. However, because the wp_theme_has_theme_json() function is based on the active theme, the has_theme_json field is not correct when fetching the theme collection with the following code, for example:

wp.data.select( 'core' ).getEntityRecords( 'root', 'theme', { per_page: -1, _fields: [ 'stylesheet', 'has_theme_json', 'is_block_theme' ] } );

To solve this, I think we need a has_theme_json() method, similar to the block_theme() method.

Change History (3)

#1 @wildworks
16 months ago

  • Owner set to wildworks
  • Status newassigned

#4 @wildworks
16 months ago

I'm not sure how to apply this PR to Gutenberg because WP_Theme is a final class and the Gutenberg plugin cannot extend it.

Last edited 15 months ago by wildworks (previous) (diff)
Note: See TracTickets for help on using tickets.