Created
September 28, 2020 03:53
-
-
Save cryptexvinci/467faf7211d3055d59862eb87653a2cd to your computer and use it in GitHub Desktop.
Custom Ultimate Member fields in WordPress User Admin Panel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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