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:
@@ -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'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user