REST API: Change which users are shown in the users endpoint.

Only show users that have authored a post of a post type that has `show_in_rest` set to true.

Props rachelbaker, jnylen0.
See #38878.



git-svn-id: https://develop.svn.wordpress.org/trunk@39843 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Aaron D. Campbell
2017-01-11 14:13:48 +00:00
parent 7710b3d3ec
commit 35bd561765
2 changed files with 104 additions and 16 deletions

View File

@@ -249,7 +249,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
}
if ( ! current_user_can( 'list_users' ) ) {
$prepared_args['has_published_posts'] = true;
$prepared_args['has_published_posts'] = get_post_types( array( 'show_in_rest' => true ), 'names' );
}
if ( ! empty( $prepared_args['search'] ) ) {