From 4dab905dba367b5f63070f85e0b1f651b78fc264 Mon Sep 17 00:00:00 2001 From: Ryan McCue Date: Mon, 31 Oct 2016 03:53:32 +0000 Subject: [PATCH] REST API: Support password on non-post post types. The password field was incorrectly only added to "post" post types, but is supported for all post types in the Dashboard UI. Props jnylen0. Fixes #38582. Built from https://develop.svn.wordpress.org/trunk@39047 git-svn-id: http://core.svn.wordpress.org/trunk@38989 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../class-wp-rest-attachments-controller.php | 2 ++ .../endpoints/class-wp-rest-posts-controller.php | 11 +++++------ wp-includes/version.php | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php index 52c84e15a6..2749b12d22 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php @@ -419,6 +419,8 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller { 'readonly' => true, ); + unset( $schema['properties']['password'] ); + return $schema; } diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index 49d030bad7..b36ba66654 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -1747,6 +1747,11 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), + 'password' => array( + 'description' => __( 'A password to protect access to the content and excerpt.' ), + 'type' => 'string', + 'context' => array( 'edit' ), + ), ), ); @@ -1948,12 +1953,6 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { 'type' => 'boolean', 'context' => array( 'view', 'edit' ), ); - - $schema['properties']['password'] = array( - 'description' => __( 'A password to protect access to the content and excerpt.' ), - 'type' => 'string', - 'context' => array( 'edit' ), - ); } if ( 'page' === $this->post_type ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 6fa2803807..b88dadb97f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-beta1-39046'; +$wp_version = '4.7-beta1-39047'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.