Skip to content

Instantly share code, notes, and snippets.

@cryptexvinci
Created September 28, 2020 03:53
Show Gist options
  • Save cryptexvinci/467faf7211d3055d59862eb87653a2cd to your computer and use it in GitHub Desktop.
Save cryptexvinci/467faf7211d3055d59862eb87653a2cd to your computer and use it in GitHub Desktop.
Custom Ultimate Member fields in WordPress User Admin Panel
<?php
add_filter( 'manage_users_columns', 'um_custom_add_new_user_column' );
function um_custom_add_new_user_column( $columns ) {
$columns['um_country'] = 'Country';
return $columns;
}
add_filter( 'manage_users_custom_column', 'um_custom_add_new_user_column_content', 10, 3 );
function um_custom_add_new_user_column_content( $content, $column, $user_id ) {
// Change the 2nd paramenter with your desired UM Meta Key
if ( 'um_country' === $column ) {
$content = get_user_meta( $user_id, 'country', true );
}
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment