Skip to content

Commit 640cca7

Browse files
Docs: Correct @global tags in WP_User_Query::prepare_query().
* `$blog_id` global was replaced with `get_current_blog_id()` and is no longer used directly. * `$wp_roles` global usage was previously undocumented. Follow-up to [32637], [38457], [51943]. Props shoaibkarimali. Fixes #56543. git-svn-id: https://develop.svn.wordpress.org/trunk@54119 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 438822a commit 640cca7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/wp-includes/class-wp-user-query.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ public static function fill_query_vars( $args ) {
140140
* @since 5.3.0 Introduced the 'meta_type_key' parameter.
141141
* @since 5.9.0 Added 'capability', 'capability__in', and 'capability__not_in' parameters.
142142
*
143-
* @global wpdb $wpdb WordPress database abstraction object.
144-
* @global int $blog_id
143+
* @global wpdb $wpdb WordPress database abstraction object.
144+
* @global WP_Roles $wp_roles WordPress role management object.
145145
*
146146
* @param string|array $query {
147147
* Optional. Array or string of Query parameters.
@@ -256,7 +256,7 @@ public static function fill_query_vars( $args ) {
256256
* }
257257
*/
258258
public function prepare_query( $query = array() ) {
259-
global $wpdb;
259+
global $wpdb, $wp_roles;
260260

261261
if ( empty( $this->query_vars ) || ! empty( $query ) ) {
262262
$this->query_limit = null;
@@ -448,8 +448,6 @@ public function prepare_query( $query = array() ) {
448448
$available_roles = array();
449449

450450
if ( ! empty( $qv['capability'] ) || ! empty( $qv['capability__in'] ) || ! empty( $qv['capability__not_in'] ) ) {
451-
global $wp_roles;
452-
453451
$wp_roles->for_site( $blog_id );
454452
$available_roles = $wp_roles->roles;
455453
}

0 commit comments

Comments
 (0)