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 registered a custom post type (foo) with register_post_type, setting 'hierarchical' => true,so now when I want to use it I have post_type=foo.

How can I query child of foo? any ideas?


share|improve this question
up vote 1 down vote accepted

You can display child pages of particular parent foo page using following code ( using parent page ID ):

$the_query = new WP_Query( 'post_type=foo&post_parent=93' );

// The Loop
while ( $the_query->have_posts() ) :
echo '<li>' . get_the_title() . '</li>';
share|improve this answer
thanks mate, I was looking for all complex solutions but nothing so obvious, thanks a lot! – bboy Feb 28 '13 at 10:57

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.