REST API: Validate posts status enum
Currently we are using a different validate callback, so the `enum` is not interpretted. We just have to fallback to the result of `rest_validate_request_arg` in our custom wrapper function. Fixes #38417. Built from https://develop.svn.wordpress.org/trunk@38911 git-svn-id: http://core.svn.wordpress.org/trunk@38854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5f777155f2
commit
e8a311ed02
|
@ -1947,11 +1947,11 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
|||
*/
|
||||
public function validate_user_can_query_private_statuses( $value, $request, $parameter ) {
|
||||
if ( 'publish' === $value ) {
|
||||
return true;
|
||||
return rest_validate_request_arg( $value, $request, $parameter );
|
||||
}
|
||||
$post_type_obj = get_post_type_object( $this->post_type );
|
||||
if ( current_user_can( $post_type_obj->cap->edit_posts ) ) {
|
||||
return true;
|
||||
return rest_validate_request_arg( $value, $request, $parameter );
|
||||
}
|
||||
return new WP_Error( 'rest_forbidden_status', __( 'Status is forbidden.' ), array( 'status' => rest_authorization_required_code() ) );
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-alpha-38910';
|
||||
$wp_version = '4.7-alpha-38911';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue