From daf358983cc1ce0c77bf6d2de2ebbb43df2add60 Mon Sep 17 00:00:00 2001 From: Aaron Campbell Date: Wed, 11 Jan 2017 14:14:42 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@39843 git-svn-id: http://core.svn.wordpress.org/trunk@39781 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../rest-api/endpoints/class-wp-rest-users-controller.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php index d3d253a38a..4f6c378a11 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php @@ -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'] ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 6a407d6351..8f30099228 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.8-alpha-39831'; +$wp_version = '4.8-alpha-39843'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.