Make WordPress Core


Ignore:
Timestamp:
10/25/2016 05:12:18 PM (9 years ago)
Author:
joehoyle
Message:

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.

File:
1 edited

Legend:

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

    r38832 r38911  
    19481948    public function validate_user_can_query_private_statuses( $value, $request, $parameter ) {
    19491949        if ( 'publish' === $value ) {
    1950             return true;
     1950            return rest_validate_request_arg( $value, $request, $parameter );
    19511951        }
    19521952        $post_type_obj = get_post_type_object( $this->post_type );
    19531953        if ( current_user_can( $post_type_obj->cap->edit_posts ) ) {
    1954             return true;
     1954            return rest_validate_request_arg( $value, $request, $parameter );
    19551955        }
    19561956        return new WP_Error( 'rest_forbidden_status', __( 'Status is forbidden.' ), array( 'status' => rest_authorization_required_code() ) );
Note: See TracChangeset for help on using the changeset viewer.