Skip to content

Commit

Permalink
fix: undefined variable error
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoo committed Sep 19, 2023
1 parent 9231f5d commit 4bf312c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions includes/class-newspack-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,10 @@ function ( $acc, $block ) use ( $block_name ) {
}
if ( $categories && count( $categories ) ) {
if ( 1 === $include_subcategories ) {
$children = [];
foreach ( $categories as $parent ) {
$children[] = get_categories( array( 'child_of' => $parent ) );
foreach ( $children[0] as $child ) {
$children = array_merge( $children, get_categories( [ 'child_of' => $parent ] ) );
foreach ( $children as $child ) {
$categories[] = $child->term_id;
}
}
Expand Down

0 comments on commit 4bf312c

Please sign in to comment.