How to expand the admin user list page?

The following is an image of the WordPress admin user list:

All I want to do is add an extra column called add badges. The column value must be a link to another page.

I tried editing the main files, but in the end I realized that this is bad practice, because if I make changes, I will lose the changes with the next update.

What WordPress does is that it uses $wp_list_table = _get_list_table('WP_Users_List_Table'); to get the table and $wp_list_table->display(); to display the table.

How to add a field to the table and expand the admin user list page?

+4
source share
2 answers

You need filters manage_users_columns and manage_users_custom_column .

Code from Displaying the user ID on the main page of the user from the screen settings :

 add_filter( 'manage_users_columns', 'column_register_wpse_101322' ); add_filter( 'manage_users_custom_column', 'column_display_wpse_101322', 10, 3 ); function column_register_wpse_101322( $columns ) { $columns['uid'] = 'ID'; return $columns; } function column_display_wpse_101322( $empty, $column_name, $user_id ) { if ( 'uid' != $column_name ) return $empty; return "<strong>$user_id</strong>"; } 
+6
source

I believe that if you follow the instructions, you will get what you are looking for:

http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields

-4
source

Source: https://habr.com/ru/post/1499939/


All Articles