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. git-svn-id: https://develop.svn.wordpress.org/trunk@43137 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
09faa13278
commit
3be9a7568d
@ -196,7 +196,8 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
|||||||
$can_view = false;
|
$can_view = false;
|
||||||
$types = get_post_types( array( 'show_in_rest' => true ), 'objects' );
|
$types = get_post_types( array( 'show_in_rest' => true ), 'objects' );
|
||||||
foreach ( $types as $type ) {
|
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;
|
$can_view = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user