Description
Filters the query $args
used by WP_Query
to display text for each user.
Parameters
apply_filters( 'acf/fields/user/query', $args, $field, $post_id );
$array
(array) The query args. See WP_Query for available args.$field
(array) The field array containing all settings.$post_id
(WP_Post) The post ID where the value is saved.
Modifiers
This filter provides modifiers to target specific fields. The following filter names are available:
acf/fields/user/query
Applies to all fields.acf/fields/user/query/name={$name}
Applies to all fields of a specific name.acf/fields/user/query/key={$key}
Applies to all fields of a specific key.
Example
This example demonstrates how to modify some of the User field query args. The $args
returned are passed into a WP_User_Query
. See the WP_User_Query documentation for a full list of supported parameters.
functions.php
<?php
add_filter('acf/fields/user/query', 'my_acf_fields_user_query', 10, 3);
function my_acf_fields_user_query( $args, $field, $post_id ) {
// Show 40 users per AJAX call
$args['number'] = 40;
return $args;
}