Home › Forums › Backend Issues (wp-admin) › Admin users list – new sortable column based on custom field › Reply To: Admin users list – new sortable column based on custom field
Hi @lsell ,
I have a similar thing to achieve. I used the @pawciak code to show a column in the dashboard’s users page that consists of an ACF text field:
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'] = 'ID';
return $columns;
}
function column_display_acf_id( $value, $column_name, $user_id )
{
$user_info = get_user_meta( $user_id, 'czlonek_id', true );
if($column_name == 'id_col') return $user_info;
return $value;
}
czlonek_id
is my ACf field name (location: user form > equal > add/edit). However this doesn’t work – the column shows up, but the value does not.
Any advice? Thx.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.