Skip to content

Commit

Permalink
ensure the data is safe closer to the point it used
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Apr 4, 2022
1 parent bc51359 commit b200750
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/compat/wordpress-6.0/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}
Expand All @@ -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,
);
}
Expand Down

0 comments on commit b200750

Please sign in to comment.