wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_update_term_count › WordPress Function
Since2.3.0
已弃用n/a
› wp_update_term_count ( $terms, $taxonomy, $do_deferred = false )
| 参数: (3) |
|
| 返回: |
|
| 定义在: |
|
| 文档: |
Updates the amount of terms in taxonomy.
If there is a taxonomy callback applied, then it will be called for updating the count. The default action is to count what the amount of terms have the relationship of term ID. Once that is done, then update the database.Related Functions: wp_update_term_count_now, wp_update_user_counts, _update_post_term_count, wp_update_network_counts, wp_update_term
源码
function wp_update_term_count( $terms, $taxonomy, $do_deferred = false ) {
static $_deferred = array();
if ( $do_deferred ) {
foreach ( (array) array_keys( $_deferred ) as $tax ) {
wp_update_term_count_now( $_deferred[ $tax ], $tax );
unset( $_deferred[ $tax ] );
}
}
if ( empty( $terms ) ) {
return false;
}
if ( ! is_array( $terms ) ) {
$terms = array( $terms );
}
if ( wp_defer_term_counting() ) {
$_deferred[ $taxonomy ] = array_unique( array_merge( $_deferred[ $taxonomy ] ?? array(), $terms ) );
return true;
}
return wp_update_term_count_now( $terms, $taxonomy );
}