Make WordPress Core

Changeset 43138 for branches/4.9


Ignore:
Timestamp:
05/03/2018 06:53:09 AM (7 years ago)
Author:
SergeyBiryukov
Message:

REST API: When handling who=authors query parameter for GET wp/v2/users, only check edit_posts for post types that support author.

Props danielbachhuber.
Merges [43137] to the 4.9 branch.
Fixes #42202.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    r43067 r43138  
    191191            $types = get_post_types( array( 'show_in_rest' => true ), 'objects' );
    192192            foreach ( $types as $type ) {
    193                 if ( current_user_can( $type->cap->edit_posts ) ) {
     193                if ( post_type_supports( $type->name, 'author' )
     194                    && current_user_can( $type->cap->edit_posts ) ) {
    194195                    $can_view = true;
    195196                }
Note: See TracChangeset for help on using the changeset viewer.