Make WordPress Core


Ignore:
Timestamp:
11/23/2016 02:46:42 AM (7 years ago)
Author:
joehoyle
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r39342 r39343  
    19291929            'description' => __( 'The theme file to use to display the object.' ),
    19301930            'type'        => 'string',
    1931             'enum'        => array_keys( wp_get_theme()->get_page_templates( null, $this->post_type ) ),
     1931            'enum'        => array_merge( array_keys( wp_get_theme()->get_page_templates( null, $this->post_type ) ), array( '' ) ),
    19321932            'context'     => array( 'view', 'edit' ),
    19331933        );
Note: See TracChangeset for help on using the changeset viewer.