wc_recount_all_terms()
Recounts all terms for product categories and product tags.
Хуков нет.
Возвращает
null. Ничего (null).
Использование
wc_recount_all_terms( $include_callback );
- $include_callback(true|false)
- True to update the standard term counts in addition to the product-specific counts, which will cause a lot more queries to run.
По умолчанию:true
Список изменений
| С версии 5.2 | Введена. |
Код wc_recount_all_terms() wc recount all terms WC 10.5.2
function wc_recount_all_terms( bool $include_callback = true ) {
$product_cats = get_terms(
array(
'taxonomy' => 'product_cat',
'hide_empty' => false,
'fields' => 'id=>parent',
)
);
_wc_term_recount( $product_cats, get_taxonomy( 'product_cat' ), $include_callback, false );
$product_tags = get_terms(
array(
'taxonomy' => 'product_tag',
'hide_empty' => false,
'fields' => 'id=>parent',
)
);
_wc_term_recount( $product_tags, get_taxonomy( 'product_tag' ), $include_callback, false );
}