[wp-trac] [WordPress Trac] #45016: REST API: Expose theme_supports data on the index or similar
WordPress Trac
noreply at wordpress.org
Mon Oct 1 12:29:36 UTC 2018
#45016: REST API: Expose theme_supports data on the index or similar
-----------------------------+------------------------------------------
Reporter: danielbachhuber | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 5.0
Component: General | Version:
Severity: normal | Keywords: needs-patch needs-unit-tests
Focuses: rest-api |
-----------------------------+------------------------------------------
In order to correctly render parts of its UI, Gutenberg needs access to
the data from `post-formats` and `post-thumbnails`:
{{{
$formats = get_theme_support( 'post-formats' );
$formats = is_array( $formats ) ? array_values( $formats[0] ) : array();
$formats = array_merge( array( 'standard' ), $formats );
$site_info['theme_supports']['formats'] = $formats;
}}}
{{{
$post_thumbnails = get_theme_support( 'post-thumbnails' );
if ( $post_thumbnails ) {
// $post_thumbnails can contain a nested array of post types.
// e.g. array( array( 'post', 'page' ) ).
$site_info['theme_supports']['post-thumbnails'] = is_array(
$post_thumbnails ) ? $post_thumbnails[0] : true;
}
}}}
In [https://github.com/WordPress/gutenberg/pull/6318
wordpress/gutenberg#6318], this data landed on the REST API index.
As mentioned by @pento in
https://core.trac.wordpress.org/ticket/43817#comment:4, the ''ideal''
location for this data would be a read-only Theme object. However, we may
or may not have the time to accomplish this by our deadline.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45016>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list