I know it has been asked many times on this website but I can't really get it to work with those examples.

This is my function so far:

$city_ids = get_pages( 
        "hierarchical" => 0, 
        "sort_column" => "menu_order", 
        "sort_order" => "desc", 
        "meta_key" => "country", 
        "meta_value" => $atts['country']

This works. It gives me the page I want (Verhuizen naar Nederland), but I now need to child pages. It has three pages. See (There is one more):

enter image description here

  • What kind of output are you looking for, objects, ids, html, ... ?
    – birgire
    Oct 19, 2016 at 8:44
  • @birgire I want id's. I will use get_field later on from the ACF plugin. Oct 19, 2016 at 8:56

2 Answers 2


There is a function get_page_children available for this purpose, have a look on the documentation and examples.


  • I think I'm the stupid one but I can't get it to work Oct 19, 2016 at 8:55

I suggest using WP_Query inside the loop that displays the cities / parents and populate $id with e.g. $city->ID / $post->ID:

$children = new WP_Query( 
        "post_parent" => $id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.