We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 02a10d7 commit eb692e1Copy full SHA for eb692e1
src/wp-includes/post.php
@@ -6271,7 +6271,13 @@ function get_page_children( $page_id, $pages ) {
6271
$page_ids = wp_list_pluck( $pages, 'ID' );
6272
6273
foreach ( $parent_ids as $parent_id ) {
6274
- if ( 0 !== $parent_id && ! in_array( $parent_id, $page_ids, true ) ) {
+ if ( 0 === $parent_id || in_array( $parent_id, $page_ids, true ) ) {
6275
+ continue;
6276
+ }
6277
+
6278
+ $parent_exists = (bool) get_post( $parent_id );
6279
6280
+ if ( $parent_exists && isset( $children[ $parent_id ] ) ) {
6281
foreach ( $children[ $parent_id ] as $orphan ) {
6282
$page_list[] = $orphan;
6283
if ( isset( $children[ $orphan->ID ] ) ) {
0 commit comments