print_column_headers()
云策文档标注
概述
print_column_headers() 函数用于在 WordPress 后台打印特定屏幕的列标题。它通过 _WP_List_Table_Compat 类调用 WP_List_Table::print_column_headers() 方法来实现功能。
关键要点
- 函数接受两个参数:$screen(必需,屏幕钩子名或屏幕对象)和 $with_id(可选,布尔值,控制是否设置 ID 属性,默认 true)。
- 内部使用 _WP_List_Table_Compat 类来兼容处理,并调用 WP_List_Table::print_column_headers() 方法打印列标题。
- 自 WordPress 2.7.0 版本引入,相关函数包括 _WP_List_Table_Compat::__construct() 和 WP_List_Table::print_column_headers()。
原文内容
Prints column headers for a particular screen.
Parameters
$screenstring|WP_Screenrequired-
The screen hook name or screen object.
$with_idbooloptional-
Whether to set the ID attribute or not.
Default:
true
Source
function print_column_headers( $screen, $with_id = true ) {
$wp_list_table = new _WP_List_Table_Compat( $screen );
$wp_list_table->print_column_headers( $with_id );
}
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |