REST API: Allow unsetting of page templates in update requests.
Sending a request to update a page with the template property set to an empty string resulted in an error because “” was not a valid value in the enum. Props lucasstark, swissspidy. Fixes #38877. Built from https://develop.svn.wordpress.org/trunk@39343 git-svn-id: http://core.svn.wordpress.org/trunk@39283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1928,7 +1928,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
$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 ) ),
|
||||
'enum' => array_merge( array_keys( wp_get_theme()->get_page_templates( null, $this->post_type ) ), array( '' ) ),
|
||||
'context' => array( 'view', 'edit' ),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user