Make WordPress Core

Opened 4 weeks ago

Last modified 10 days ago

#63299 assigned enhancement

WP_Theme: Add "has_theme_json" method

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

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
4 weeks ago

  • Owner set to wildworks
  • Status changed from new to assigned

#4 @wildworks
4 weeks 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 10 days ago by wildworks (previous) (diff)
Note: See TracTickets for help on using tickets.