Need wp_query to return all children and grandchildren
Ok, I found a solution. I first looped through and got all the child page ID’s, created an array, and used post_parent__in <?php $parentarray = array($parentid); $parentposts = new WP_Query( array( ‘posts_per_page’ => -1, ‘post_type’ => ‘page’, ‘post_parent’ => $parentid ) ); while ( $parentposts->have_posts() ): $parentposts->the_post(); ?> <?php $parentarray[] = get_the_id(); ?> <?php endwhile; … Read more