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.
Fixes #42202.
Built from https://develop.svn.wordpress.org/trunk@43137


git-svn-id: http://core.svn.wordpress.org/trunk@42966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-05-03 06:52:21 +00:00
parent 074535cac3
commit 4c43e71478
2 changed files with 3 additions and 2 deletions

View File

@ -196,7 +196,8 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
$can_view = false;
$types = get_post_types( array( 'show_in_rest' => true ), 'objects' );
foreach ( $types as $type ) {
if ( current_user_can( $type->cap->edit_posts ) ) {
if ( post_type_supports( $type->name, 'author' )
&& current_user_can( $type->cap->edit_posts ) ) {
$can_view = true;
}
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-43135';
$wp_version = '5.0-alpha-43137';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.