Make WordPress Core


Ignore:
Timestamp:
02/04/2025 08:59:04 AM (9 months ago)
Author:
Mamaduka
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r59543 r59761  
    26392639        }
    26402640        if ( ! empty( $block->context['query']['parents'] ) && is_post_type_hierarchical( $query['post_type'] ) ) {
    2641             $query['post_parent__in'] = array_filter( array_map( 'intval', $block->context['query']['parents'] ) );
     2641            $query['post_parent__in'] = array_unique( array_map( 'intval', $block->context['query']['parents'] ) );
    26422642        }
    26432643    }
Note: See TracChangeset for help on using the changeset viewer.