SO网友:Frank P. Walentynowicz
这个过程非常简单。将以下代码片段添加到当前(最好是子)主题functions.php
.
Step 1 - 将新列添加到用户表列表:
function wpse_add_user_table_list_column($column) {
$column[\'call_sign\'] = \'Call Sign\';
return $column;
}
add_filter(\'manage_users_columns\', \'wpse_add_user_table_list_column\');
Step 2 - 使此新列可排序:
function wpse_user_table_list_sortable_columns($columns) {
$columns[\'call_sign\'] = \'call_sign\';
return $columns;
}
add_filter(\'manage_users_sortable_columns\', \'wpse_user_table_list_sortable_columns\');
Step 3 - 为此新列提供值:
function wpse_user_table_list_column_value($val, $column_name, $user_id) {
if(\'call_sign\' === $column_name) {
// code to set new value ( $new_value )
return $new_value;
}
return $val;
}
add_filter(\'manage_users_custom_column\', \'wpse_user_table_list_column_value\', 10, 3);