_woocommerce_term_recount
This commit is contained in:
parent
dcf54c23bd
commit
c3232d613d
|
@ -109,7 +109,7 @@ class WC_Admin_Status {
|
|||
|
||||
$product_tags = get_terms( 'product_tag', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
|
||||
|
||||
_woocommerce_term_recount( $product_cats, get_taxonomy( 'product_tag' ), false, false );
|
||||
_woocommerce_term_recount( $product_tags, get_taxonomy( 'product_tag' ), false, false );
|
||||
|
||||
echo '<div class="updated"><p>' . __( 'Terms successfully recounted', 'woocommerce' ) . '</p></div>';
|
||||
break;
|
||||
|
|
|
@ -391,11 +391,9 @@ function _woocommerce_term_recount( $terms, $taxonomy, $callback = true, $terms_
|
|||
$terms = array_filter( (array) $terms );
|
||||
|
||||
// Ancestors need counting
|
||||
if ( $terms ) {
|
||||
if ( is_taxonomy_hierarchical( $taxonomy->name ) && $terms ) {
|
||||
foreach ( $terms as $term_id ) {
|
||||
if ( is_taxonomy_hierarchical( $taxonomy->name ) ) {
|
||||
$terms = array_merge( $terms, get_ancestors( $term_id, $taxonomy->name ) );
|
||||
}
|
||||
$terms = array_merge( $terms, get_ancestors( $term_id, $taxonomy->name ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue