Sorting Users page admin column with ACF field

You can use the “pre_user_query” filter hook to modify the query that retrieves the users.

Here’s an example code that how to sort the Users page admin column with an ACF field named.

function sort_users_by_acf_field( $query ) {
    if ( ! is_admin() ) {
        return;
    }
    if ( isset( $query->query_vars['orderby'] ) && 'user_company_name' === $query->query_vars['orderby'] ) {
        $query->query_vars['meta_key'] = 'user_company_name';
        $query->query_vars['orderby'] = 'meta_value';
    }
}
add_action('pre_user_query','sort_users_by_acf_field');

Hope this will help!