<?php
add_filter('manage_users_columns', 'knuckles_add_user_id_column');
function knuckles_add_user_id_column($columns) {
$columns['user_id'] = 'User ID';
return $columns;
}
add_action('manage_users_custom_column', 'knuckles_show_user_id_column_content', 10, 3);
function knuckles_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;
}
Being able to quickly find the unique ID number of any user in your WordPress database can be very useful, especially if you run a website with lots of users. One of the ways that we can easily find a user’s ID is by customizing the table displayed on the wp-admin/users.php page. We can add a custom column that will display the ID number of every user.
To add the user ID column, you can either copy above code into your functions.php, or add it as its own plugin.
Using the same methods as I have here, you could very easily add custom columns for even more user attributes, such as the user’s comment count.
To add the user ID column, you can either copy above code into your functions.php, or add it as its own plugin.
Using the same methods as I have here, you could very easily add custom columns for even more user attributes, such as the user’s comment count.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.