taxonomy_parent_dropdown_args
云策文档标注
概述
taxonomy_parent_dropdown_args 是一个 WordPress 过滤器,用于在编辑分类法术语页面中自定义父级下拉菜单的参数。它允许开发者调整下拉菜单的行为和显示选项。
关键要点
- 过滤器名称:taxonomy_parent_dropdown_args
- 主要用途:过滤分类法父级下拉菜单的参数数组
- 参数:$dropdown_args(参数数组)、$taxonomy(分类法slug)、$context(上下文,可选 'new' 或 'edit')
- 常用参数包括 hide_empty、hide_if_empty、taxonomy、name、orderby、hierarchical、show_option_none 等
- 版本历史:从 WordPress 3.7.0 引入,4.2.0 添加了 $context 参数
代码示例
$dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' );
原文内容
Filters the taxonomy parent drop-down on the Edit Term page.
Parameters
$dropdown_argsarray-
An array of taxonomy parent drop-down arguments.
hide_emptyint|boolWhether to hide terms not attached to any posts. Default 0.hide_if_emptyboolWhether to hide the drop-down if no terms exist. Default false.taxonomystringThe taxonomy slug.namestringValue of the name attribute to use for the drop-down select element.
Default'parent'.orderbystringThe field to order by. Default'name'.hierarchicalboolWhether the taxonomy is hierarchical. Default true.show_option_nonestringLabel to display if there are no terms. Default'None'.
$taxonomystring-
The taxonomy slug.
$contextstring-
Filter context. Accepts
'new'or'edit'.
Source
$dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' );