list_table_primary_column
最后更新于:2021-11-27 02:53:54
apply_filters( ‘list_table_primary_column’, string $default, string $context )
Filters the name of the primary column for the current list table.
参数
- $default
-
(string)
Column name default for the specific list table, e.g. ‘name’. - $context
-
(string)
Screen ID for specific list table, e.g. ‘plugins’.
源文件
文件: gc-admin/includes/class-gc-list-table.php
function my_list_table_primary_column( $default, $screen ) {// Alter the primary column in edit.php table(s) // if we want the 'Name' column to be the primary column, on Users screen if ( 'users' === $screen ) { $default = 'name'; } // if we want to set the primary column for CPT if ( 'edit-my_custom_post_type' === $screen ) { $default = 'my_custom_column_name'; } return $default; } add_filter( 'list_table_primary_column', 'my_list_table_primary_column', 10, 2 );