How to display multiple custom columns in the wp-admin users.php?

hummm… do you mean something like this :

function mysite_column_company( $defaults ) {
    $defaults['mysite-usercolumn-company'] = __('Company', 'user-column');
    $defaults['mysite-usercolumn-otherfield1'] = __('Other field 1', 'user-column');
    $defaults['mysite-usercolumn-otherfield2'] = __('Other field 2', 'user-column');
    return $defaults;
}
function mysite_custom_column_company($value, $column_name, $id) {
    if( $column_name == 'mysite-usercolumn-company' ) {
        return get_the_author_meta( 'company', $id );
    }
    elseif( $column_name == 'mysite-usercolumn-otherfield1' ) {
        return get_the_author_meta( 'otherfield1', $id );
    }
    elseif( $column_name == 'mysite-usercolumn-otherfield2' ) {
        return get_the_author_meta( 'otherfield2', $id );
    }
}

by the way, you should use get_the_author_meta() instead of get_usermeta() as it is deprecated.

Leave a Comment