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
This commit is contained in:
Mamaduka 2025-02-04 09:01:17 +00:00
parent e1877c1c42
commit 5b8a20d134
2 changed files with 2 additions and 2 deletions

View File

@ -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'] ) );
}
}

View File

@ -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.