Home Forums Front-end Issues User field – Select2 doesn't search for names Reply To: User field – Select2 doesn't search for names

  • Select2 is just a JavaScript api that fills the fields and allows dong so using AJAX, it does not connect directly to the DB to get information or alter the way WP works. The underlying function that gets those values for display is still part of WP.

    As you can see by looking at the php file for the users field (/fields/user.php) on lines 129 to 135.

    // filters
    $args = apply_filters("acf/fields/user/query", $args, $field, $options['post_id']);
    $args = apply_filters("acf/fields/user/query/name={$field['_name']}", $args, $field, $options['post_id']);
    $args = apply_filters("acf/fields/user/query/key={$field['key']}", $args, $field, $options['post_id']);
    // get users
    $users = get_users( $args );