get_column_headers

函数
get_column_headers ( $screen )
参数
  • (string|WP_Screen) $screen The screen you want the headers for
    Required:
返回值
  • (string[]) The column header labels keyed by column ID.
定义位置
相关方法
print_column_headersregister_column_headersget_custom_headerget_headerget_cli_args
引入
2.7.0
弃用
-

get_column_headers: 这个函数为WordPress管理区的文章或页面列表表返回一个列标题数组。

获取一个屏幕的列标题。

function get_column_headers( $screen ) {
	static $column_headers = array();

	if ( is_string( $screen ) ) {
		$screen = convert_to_screen( $screen );
	}

	if ( ! isset( $column_headers[ $screen->id ] ) ) {
		/**
		 * Filters the column headers for a list table on a specific screen.
		 *
		 * The dynamic portion of the hook name, `$screen->id`, refers to the
		 * ID of a specific screen. For example, the screen ID for the Posts
		 * list table is edit-post, so the filter for that screen would be
		 * manage_edit-post_columns.
		 *
		 * @since 3.0.0
		 *
		 * @param string[] $columns The column header labels keyed by column ID.
		 */
		$column_headers[ $screen->id ] = apply_filters( "manage_{$screen->id}_columns", array() );
	}

	return $column_headers[ $screen->id ];
}

常见问题

FAQs
查看更多 >