WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to get all pages that are direct children of HOME_ID. Per http://codex.wordpress.org/Function_Reference/get_pages#Parameters (see 'parent' parameter), I think this should be done with get_pages:

$top_pages = get_pages(array('parent' => HOME_ID, 'sort_column' => 'menu_order'));

but this returns no results. I get results back if I plug in 0 for HOME_ID. No sweat because I can achieve what I want with:

$menu_wp_query = new WP_Query();
$top_pages = $menu_wp_query->query(array('post_type' => 'page', 'post_parent' => HOME_ID, 'orderby' => 'menu_order'));

But still uncomfortable; is this a bug? Using WP 3.2.1 Thanks.

share|improve this question
have u noticed that parent is an integer value? – andresmijares25 Dec 11 '11 at 7:47
up vote 1 down vote accepted

Assuming that, by "HOME_ID", you are referring to the static Page used to display the Site Front Page, then you want to use get_option( 'front_page' ) to get the ID for this page:

$menu_wp_query_args = array(
    'post_type' => 'page', 
    'post_parent' => get_option( 'front_page' ), 
    'orderby' => 'menu_order'
$new_wp_query = new WP_Query( $new_wp_query_args );
share|improve this answer

Assuming your homepage has title as 'Home'. Use this:


$home = get_page_by_title('Home');
$home_children = get_posts(array('post_type'=>'page', 'post_parent'=>$home->ID));

echo "<pre>";
echo "</pre>";    


Make sure you pass the exact title to the get_page_by_title function.

share|improve this answer

in a custom template Page i use

query_posts(array( 'post_parent' => 6, 'post_type' => 'page'));

post_parent is selected by ID of the specific Page, in this case 6. ..at least it works for me. Hope that helps. cheers!

share|improve this answer
Do not use query_posts() for secondary loop queries. – Chip Bennett Apr 12 '12 at 14:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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