Filter hook 'wp_dropdown_users_args'

in WP Core File wp-includes/user.php at line 1779

View Source

wp_dropdown_users_args

Filter Hook
Description
Filters the query arguments for the list of users in the dropdown.

Hook Information

File Location wp-includes/user.php View on GitHub
Hook Type Filter
Line Number 1779

Hook Parameters

Type Name Description
array $query_args The query arguments for get_users().
array $parsed_args The arguments passed to wp_dropdown_users() combined with the defaults.

Usage Examples

Basic Usage
<?php
// Hook into wp_dropdown_users_args
add_filter('wp_dropdown_users_args', 'my_custom_filter', 10, 2);

function my_custom_filter($query_args, $parsed_args) {
    // Your custom filtering logic here
    return $query_args;
}

Source Code Context

wp-includes/user.php:1779 - How this hook is used in WordPress core
<?php
1774  	 * @since 4.4.0
1775  	 *
1776  	 * @param array $query_args  The query arguments for get_users().
1777  	 * @param array $parsed_args The arguments passed to wp_dropdown_users() combined with the defaults.
1778  	 */
1779  	$query_args = apply_filters( 'wp_dropdown_users_args', $query_args, $parsed_args );
1780  
1781  	$users = get_users( $query_args );
1782  
1783  	$output = '';
1784  	if ( ! empty( $users ) && ( empty( $parsed_args['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) {

PHP Documentation

<?php
/**
	 * Filters the query arguments for the list of users in the dropdown.
	 *
	 * @since 4.4.0
	 *
	 * @param array $query_args  The query arguments for get_users().
	 * @param array $parsed_args The arguments passed to wp_dropdown_users() combined with the defaults.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.