All the code below is for your current theme functios.php
file (but better use a child theme or a custom plugin).
Step 1.
Not sure if you figured out with adding the columns, but I will mention it too – use manage_users_columns
hook.
add_filter( 'manage_users_columns', 'new_modify_user_table' );
function new_modify_user_table( $columnnames ) {
return array_slice( $columnnames, 0, 3, true )
+ array( 'billing_address' => 'Billing Address' )
+ array_slice( $columnnames, 3, NULL, true );
}
array_slice()
function is required because we’re adding the column on the 3rd place in the table.
Step 2.
It is time to use manage_users_custom_column
hook to add the data to the column. So, we’re adding billing address and phone.
add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );
function new_modify_user_table_row( $val, $column_name, $user_id ) {
switch ($column_name) {
case 'billing_address' :
$val = get_user_meta( $user_id, 'billing_address_1', true ) . '<br />';
$val .= get_user_meta( $user_id, 'billing_phone', true );
break;
}
return $val;
}
If you’re looking for how to get the complete billing address information (state, country etc), look at this code example.