pre_{$taxonomy}_{$field}
云策文档标注
概述
这是一个 WordPress 过滤器钩子,用于在分类法字段被清理之前进行过滤。钩子名称是动态的,基于分类法 slug 和字段名。
关键要点
- 钩子名称格式为 pre_{$taxonomy}_{$field},其中 $taxonomy 是分类法 slug,$field 是字段名。
- 参数 $value 是分类法字段的原始值,类型为 mixed。
- 主要用于在 sanitize_term_field() 函数清理字段值之前,允许开发者修改或过滤该值。
代码示例
$value = apply_filters( "pre_{$taxonomy}_{$field}", $value );注意事项
- 此钩子从 WordPress 2.3.0 版本开始引入。
- 常用于自定义分类法字段的预处理,确保数据在清理前符合特定需求。
原文内容
Filters a taxonomy field before it is sanitized.
Description
The dynamic portions of the filter name, $taxonomy and $field, refer to the taxonomy slug and field name, respectively.
Parameters
$valuemixed-
Value of the taxonomy field.
Source
$value = apply_filters( "pre_{$taxonomy}_{$field}", $value );
Changelog
| Version | Description |
|---|---|
| 2.3.0 | Introduced. |