您可以使用下面的函数将自定义列添加到用户表中:
function modify_user_columns($column_headers) {
$column_headers[\'custom_field\'] = \'Custom field\';
return $column_headers;
}
add_action(\'manage_users_columns\', \'modify_user_columns\');
function custom_admin_css() {
echo \'<style>
.column-custom_field {width: 8%}
</style>\';
}
add_action(\'admin_head\', \'custom_admin_css\');
function user_posts_count_column_content($value, $column_name, $user_id) {
if ( \'custom_field\' == $column_name ) {
return \'Value\';
}
return $value;
}
add_action(\'manage_users_custom_column\', \'user_posts_count_column_content\', 10, 3);