WordPress.org

Make WordPress Core

Ticket #20991: 20991.patch

File 20991.patch, 1.1 KB (added by maxcutler, 6 years ago)
  • wp-includes/class-wp-xmlrpc-server.php

     
    13901390
    13911391                $query = array();
    13921392
     1393                $post_type = get_post_type_object( 'post' );
    13931394                if ( isset( $filter['post_type'] ) ) {
    13941395                        $post_type = get_post_type_object( $filter['post_type'] );
    13951396                        if ( ! ( (bool) $post_type ) )
    13961397                                return new IXR_Error( 403, __( 'The post type specified is not valid' ) );
     1398                }
    13971399
    1398                         if ( ! current_user_can( $post_type->cap->edit_posts ) )
    1399                                 return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type' ));
     1400                if ( ! current_user_can( $post_type->cap->edit_posts ) )
     1401                        return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type' ));
    14001402
    1401                         $query['post_type'] = $filter['post_type'];
    1402                 }
     1403                $query['post_type'] = $post_type->name;
    14031404
    14041405                if ( isset( $filter['post_status'] ) )
    14051406                        $query['post_status'] = $filter['post_status'];