term_id : 0; $vyatka_terms = get_terms( array( 'taxonomy' => 'product_cat', 'parent' => $vyatka_parent, 'hide_empty' => true, ) ); // A leaf category shows its siblings. if ( ( is_wp_error( $vyatka_terms ) || ! $vyatka_terms ) && $vyatka_current instanceof WP_Term ) { $vyatka_terms = array_filter( (array) get_terms( array( 'taxonomy' => 'product_cat', 'parent' => $vyatka_current->parent, 'hide_empty' => true, ) ), static fn( $term ): bool => $term instanceof WP_Term && $term->term_id !== $vyatka_current->term_id ); } if ( is_wp_error( $vyatka_terms ) || ! $vyatka_terms ) { return; } ?>