Skip to content

Commit

Permalink
Backporting latest changes from WordPress/gutenberg#39970.
Browse files Browse the repository at this point in the history
  • Loading branch information
hellofromtonya committed Apr 4, 2022
1 parent 3163816 commit e51fd0c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/wp-includes/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -1132,14 +1132,14 @@ function build_query_vars_from_query_block( $block, $page ) {
if ( ! empty( $block->context['query']['categoryIds'] ) ) {
$tax_query[] = array(
'taxonomy' => 'category',
'terms' => $block->context['query']['categoryIds'],
'terms' => array_filter( array_map( 'intval', $block->context['query']['categoryIds'] ) ),
'include_children' => false,
);
}
if ( ! empty( $block->context['query']['tagIds'] ) ) {
$tax_query[] = array(
'taxonomy' => 'post_tag',
'terms' => $block->context['query']['tagIds'],
'terms' => array_filter( array_map( 'intval', $block->context['query']['tagIds'] ) ),
'include_children' => false,
);
}
Expand All @@ -1148,13 +1148,10 @@ function build_query_vars_from_query_block( $block, $page ) {
if ( ! empty( $block->context['query']['taxQuery'] ) ) {
$query['tax_query'] = array();
foreach ( $block->context['query']['taxQuery'] as $taxonomy => $terms ) {
if ( ! empty( $terms ) ) {
$term_ids = array_map( 'intval', $terms );
$term_ids = array_filter( $term_ids );

if ( is_taxonomy_viewable( $taxonomy ) && ! empty( $terms ) ) {
$query['tax_query'][] = array(
'taxonomy' => $taxonomy,
'terms' => $terms,
'terms' => array_filter( array_map( 'intval', $terms ) ),
'include_children' => false,
);
}
Expand Down

0 comments on commit e51fd0c

Please sign in to comment.