From b2007505bde9a918ef4fea9e110e42b72d7c71b9 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Mon, 4 Apr 2022 10:34:13 +0300 Subject: [PATCH] ensure the data is safe closer to the point it used --- lib/compat/wordpress-6.0/blocks.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/compat/wordpress-6.0/blocks.php b/lib/compat/wordpress-6.0/blocks.php index d6dafd6e89e77f..40108be343ec99 100644 --- a/lib/compat/wordpress-6.0/blocks.php +++ b/lib/compat/wordpress-6.0/blocks.php @@ -77,18 +77,16 @@ function gutenberg_build_query_vars_from_query_block( $block, $page ) { if ( ! empty( $block->context['query']['categoryIds'] ) || ! empty( $block->context['query']['tagIds'] ) ) { $tax_query = array(); if ( ! empty( $block->context['query']['categoryIds'] ) ) { - $category_ids = array_filter( array_map( 'intval', $block->context['query']['categoryIds'] ) ); - $tax_query[] = array( + $tax_query[] = array( 'taxonomy' => 'category', - 'terms' => $category_ids, + 'terms' => array_filter( array_map( 'intval', $block->context['query']['categoryIds'] ) ), 'include_children' => false, ); } if ( ! empty( $block->context['query']['tagIds'] ) ) { - $tag_ids = array_filter( array_map( 'intval', $block->context['query']['tagIds'] ) ); $tax_query[] = array( 'taxonomy' => 'post_tag', - 'terms' => $tag_ids, + 'terms' => array_filter( array_map( 'intval', $block->context['query']['tagIds'] ) ), 'include_children' => false, ); } @@ -98,10 +96,9 @@ function gutenberg_build_query_vars_from_query_block( $block, $page ) { $query['tax_query'] = array(); foreach ( $block->context['query']['taxQuery'] as $taxonomy => $terms ) { if ( is_taxonomy_viewable( $taxonomy ) && ! empty( $terms ) ) { - $term_ids = array_filter( array_map( 'intval', $terms ) ); $query['tax_query'][] = array( 'taxonomy' => $taxonomy, - 'terms' => $term_ids, + 'terms' => array_filter( array_map( 'intval', $terms ) ), 'include_children' => false, ); }