I have several pages all under one parent like this
ParentPage (ID 24)
- ChildPage A
- ChildPage B
- ChildPage C
- ChildPage D
- ChildPage E
- ChildPage F
I am using WP_Query
to return all the child pages but only some are coming back. In the DB all the child pages have the same parent ID of 24.
// args
$args = array(
'numberposts' => -1,
'post_type' => 'page',
'post_parent' => 24
);
// query
$the_query = new WP_Query( $args );
// loop through posts
if( $the_query->have_posts() ): ?>
<?php while( $the_query->have_posts() ) : $the_query->the_post();?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php endwhile; ?>
<?php endif; ?>
Let's say B & C don't return. I tried assigning it to a new parent (ID25) and modify the query to return child pages of parent 25 - and the missing pages display fine.
I have virtually no plugins other than ACF PRO, which -- prior to making some new pages and fields for said pages recently -- was working fine.