Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get children of a current page
<?php
$id = the_ID();
while ( have_posts() ) : the_post();
$gp_args = array(
'post_type' => 'page',
'post_parent' => $id,
'order' => 'ASC',
'orderby' => 'menu_order',
'posts_per_page' => -1
);
$locations = get_posts($gp_args);
echo '<pre>' . print_r( $locations, true ) . '</pre>';
endwhile;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.