Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save itsjusteileen/d931ba58e9c2fb3536156366058b3e23 to your computer and use it in GitHub Desktop.
Save itsjusteileen/d931ba58e9c2fb3536156366058b3e23 to your computer and use it in GitHub Desktop.
Add extra column for city and state to Members List table for user field added via PMPro City and State Add On
//Add 'City' Column to Users List Header
function pmpro_manage_users_columns($columns) {
$columns['city'] = 'City';
return $columns;
}
add_filter('manage_users_columns', 'pmpro_manage_users_columns');
//Add 'City' Column to Users List Rows
function pmpro_manage_users_custom_column($value, $column_name, $user_id) {
$theuser = get_userdata( $user_id );
if ( 'city' == $column_name )
return $theuser->city;
return $value;
}
add_action('manage_users_custom_column', 'pmpro_manage_users_custom_column', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment