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.
Merges [39843] to 4.7 branch.

Built from https://develop.svn.wordpress.org/branches/4.7@39844


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Campbell 2017-01-11 14:49:33 +00:00
parent 75df12f322
commit 39b785c7f9
2 changed files with 2 additions and 2 deletions

View File

@ -248,7 +248,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'] ) ) {

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7.1-RC1-39832';
$wp_version = '4.7.1-RC1-39844';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.