Support

Account

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.