Skip to content

Instantly share code, notes, and snippets.

@quagliato
Created August 5, 2013 14:14
Show Gist options
  • Save quagliato/6156218 to your computer and use it in GitHub Desktop.
Save quagliato/6156218 to your computer and use it in GitHub Desktop.
Iterate children pages
$query = new WP_Query();
$all_pages = $query->query(
array(
'post_type' => 'page',
'orderby' => 'post_title',
'order' => 'ASC',
'posts_per_page' => -1));
$children = get_page_children(get_the_ID(), $all_pages);
foreach($children as $child) {
$page = get_post($child->ID);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment