update_post_term_count_statuses
云策文档标注
概述
update_post_term_count_statuses 是一个 WordPress 过滤器,用于控制在更新术语计数时包含哪些文章状态。它允许开发者自定义哪些状态的文章应被计入术语统计中。
关键要点
- 过滤器名称:update_post_term_count_statuses
- 参数:$post_statuses(字符串数组,默认包含 'publish' 状态)和 $taxonomy(当前分类法对象)
- 用途:影响 _update_post_term_count() 和 _update_term_count_on_transition_post_status() 函数中的术语计数逻辑
- 引入版本:WordPress 5.7.0
代码示例
$post_statuses = esc_sql( apply_filters( 'update_post_term_count_statuses', $post_statuses, $taxonomy ) );
原文内容
Filters the post statuses for updating the term count.
Parameters
$post_statusesstring[]-
List of post statuses to include in the count. Default is
'publish'. $taxonomyWP_Taxonomy-
Current taxonomy object.
Source
$post_statuses = esc_sql( apply_filters( 'update_post_term_count_statuses', $post_statuses, $taxonomy ) );
Changelog
| Version | Description |
|---|---|
| 5.7.0 | Introduced. |