REST API: Include template in all post type schemas.
[38951] added templates to all post types, but didn't add them to the schema. Props swissspidy. Fixes #38698. Built from https://develop.svn.wordpress.org/trunk@39182 git-svn-id: http://core.svn.wordpress.org/trunk@39122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5b676af8ff
commit
a2bbbddb9e
|
@ -1094,7 +1094,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the template for a page.
|
||||
* Sets the template for a post.
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @access public
|
||||
|
@ -1922,14 +1922,12 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
|||
);
|
||||
}
|
||||
|
||||
if ( 'page' === $this->post_type ) {
|
||||
$schema['properties']['template'] = array(
|
||||
'description' => __( 'The theme file to use to display the object.' ),
|
||||
'type' => 'string',
|
||||
'enum' => array_keys( wp_get_theme()->get_page_templates() ),
|
||||
'context' => array( 'view', 'edit' ),
|
||||
);
|
||||
}
|
||||
$schema['properties']['template'] = array(
|
||||
'description' => __( 'The theme file to use to display the object.' ),
|
||||
'type' => 'string',
|
||||
'enum' => array_keys( wp_get_theme()->get_page_templates( null, $this->post_type ) ),
|
||||
'context' => array( 'view', 'edit' ),
|
||||
);
|
||||
|
||||
$taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_rest' => true ) );
|
||||
foreach ( $taxonomies as $taxonomy ) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-beta2-39181';
|
||||
$wp_version = '4.7-beta2-39182';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue