VOOZH about

URL: https://developer.wordpress.org/reference/classes/wp_user_query/fill_query_vars/

⇱ WP_User_Query::fill_query_vars() – Method | Developer.WordPress.org


Skip to content

WordPress Developer Resources

WP_User_Query::fill_query_vars()

HomeReferenceClassesWP_User_QueryWP_User_Query::fill_query_vars()

WP_User_Query::fill_query_vars( string|array $args ): array

Fills in missing query variables with default values.

Parameters

$argsstring|arrayrequired
Query vars, as passed to WP_User_Query.

Return

array Complete query variables with undefined ones filled in with defaults.

Source

public static function fill_query_vars( $args ) {
	$defaults = array(
		'blog_id' => get_current_blog_id(),
		'role' => '',
		'role__in' => array(),
		'role__not_in' => array(),
		'capability' => '',
		'capability__in' => array(),
		'capability__not_in' => array(),
		'meta_key' => '',
		'meta_value' => '',
		'meta_compare' => '',
		'include' => array(),
		'exclude' => array(),
		'search' => '',
		'search_columns' => array(),
		'orderby' => 'login',
		'order' => 'ASC',
		'offset' => '',
		'number' => '',
		'paged' => 1,
		'count_total' => true,
		'fields' => 'all',
		'who' => '',
		'has_published_posts' => null,
		'nicename' => '',
		'nicename__in' => array(),
		'nicename__not_in' => array(),
		'login' => '',
		'login__in' => array(),
		'login__not_in' => array(),
		'cache_results' => true,
	);

	return wp_parse_args( $args, $defaults );
}

View all references View on Trac View on GitHub

Related

UsesDescription
get_current_blog_id()wp-includes/load.php

Retrieves the current site ID.

wp_parse_args()wp-includes/functions.php

Merges user defined arguments into defaults array.

Used byDescription
WP_User_Query::prepare_query()wp-includes/class-wp-user-query.php

Prepares the query variables.

Changelog

VersionDescription
4.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.