manage_taxonomies_for_{$post_type}_columns
云策文档标注
概述
manage_taxonomies_for_{$post_type}_columns 是一个 WordPress 过滤器钩子,用于在文章列表表格中过滤分类法列。它允许开发者动态控制特定文章类型显示的分类法列。
关键要点
- 钩子名称是动态的,其中 {$post_type} 部分替换为文章类型的 slug,例如 manage_taxonomies_for_post_columns 或 manage_taxonomies_for_page_columns。
- 参数包括 $taxonomies(一个字符串数组,表示要显示的分类法名称)和 $post_type(文章类型)。
- 该钩子在 WP_Posts_List_Table::get_columns() 方法中使用,用于自定义文章列表的列显示。
- 自 WordPress 3.5.0 版本引入。
原文内容
Filters the taxonomy columns in the Posts list table.
Description
The dynamic portion of the hook name, $post_type, refers to the post type slug.
Possible hook names include:
manage_taxonomies_for_post_columnsmanage_taxonomies_for_page_columns
Parameters
$taxonomiesstring[]-
Array of taxonomy names to show columns for.
$post_typestring-
The post type.
Source
$taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type );
Changelog
| Version | Description |
|---|---|
| 3.5.0 | Introduced. |