From 5b8a20d13408a9cd540e63a7bfefd4a366ff2f11 Mon Sep 17 00:00:00 2001 From: Mamaduka Date: Tue, 4 Feb 2025 09:01:17 +0000 Subject: [PATCH] Editor: Fix `parents` argument validation for Query block. Allow passing zero (`0`) via the `parents` argument. It is a valid value for hierarchical post types, often used to display top-level items. Props mamaduka, audrasjb, peterwilsoncc. Fixes #62901. Built from https://develop.svn.wordpress.org/trunk@59761 git-svn-id: http://core.svn.wordpress.org/trunk@59103 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/blocks.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index 25a4a7e3b2..c09321edfa 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -2638,7 +2638,7 @@ function build_query_vars_from_query_block( $block, $page ) { $query['s'] = $block->context['query']['search']; } if ( ! empty( $block->context['query']['parents'] ) && is_post_type_hierarchical( $query['post_type'] ) ) { - $query['post_parent__in'] = array_filter( array_map( 'intval', $block->context['query']['parents'] ) ); + $query['post_parent__in'] = array_unique( array_map( 'intval', $block->context['query']['parents'] ) ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 082d043fbf..ca1441ade0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-alpha-59760'; +$wp_version = '6.8-alpha-59761'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.