NB: Make sure you do a back up of your theme, files and database before attempting the tutorials
Easy
Last modified : Nov 16 2021
Estimated reading time : 0 minutes, 56 seconds - 61 words
Share the post "How to Display WordPress User’s ID"
In this tutorial, we will configure a function that will allow us to display WordPress admin users’ IDs. We will use the following filter: manage_users_custom_column
function addo_custom_add_user_id_column($columns) { $columns['user_id'] = 'User ID'; return $columns; } add_filter('manage_users_columns', 'addo_custom_add_user_id_column'); //Adds Content To The Custom Added Column function addo_show_user_id_column_content($value, $column_name, $user_id) { $user = get_userdata( $user_id ); if ( 'user_id' == $column_name ) return $user_id; return $value; } add_filter('manage_users_custom_column', 'addo_show_user_id_column_content', 10, 3);
After configuring this filter, you can also use pre_get_users in order to sort the users’ IDs. WordPress users: Sort by ID