Support

Account

Home Forums Add-ons Repeater Field Sort order Repeater Users Reply To: Sort order Repeater Users

  • There are filters in the user field that will let you change the sort order, the code in acf looks something like this

    
    // 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']);
    

    $args is the same as used in the wp function get_users() https://codex.wordpress.org/Function_Reference/get_users

    
    add_filter('acf/fields/user/query/name=user_field_name', 'change_user_order_by', 10, 3);
    function change_user_order_by($args, $field, $post_id) {
      $args['orderby'] = 'display_name';
      return $args;
    }