Here is how to add new column based on ACF custom field in WordPress user list.

Hook manage_users_columns

add_filter( 'manage_users_columns', 'column_register_acf_id' );
add_filter( 'manage_users_custom_column', 'column_display_acf_id', 10, 3 );

function column_register_acf_id( $columns ){

$columns['id_col'] = 'Name'; //This name will be shown on back office
return $columns;
}

function column_display_acf_id( $value, $column_name, $user_id )
{
$user_info = get_user_meta( $user_id, 'name_acf', true ); //name of your field
if($column_name == 'id_col') return $user_info;
return $value;

}

Learn more about this hook : https://developer.wordpress.org/reference/hooks/manage_users_custom_column/

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Commentaires
Oldest
Newest Most Voted
Inline Feedbacks
View all comments