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'm wanting to list my current page's child pages as list items in the sidebar of my wordpress site.

So far I've been referencing the http://codex.wordpress.org/Function_Reference/wp_list_pages

I'm unsure how to set it to show just my subpages, so far I have this:

<?php $args = array(
'depth'        => 0,
'show_date'    => '',
'date_format'  => get_option('date_format'),
'child_of'     => 0,
'exclude'      => '',
'include'      => '',
'title_li'     => __('Title'),
'echo'         => 1,
'authors'      => '',
'sort_column'  => 'menu_order, post_title',
'link_before'  => '',
'link_after'   => '',
'walker'       => '',
'post_type'    => 'page',
    'post_status'  => 'publish' 



It returns:

   Child 1
   Child 2
  Sample Page

I'm just wanting the child pages (in this case 1 & 2). I don't want to show Home and Sample Page either.

Any help greatly appreciated.

share|improve this question
up vote 0 down vote accepted

In this way you add in "exclude" parameter like this

'exclude' => '', // here add this page id you don't show in listing.

'exclude' => '2,4', like this

If you want only child pages you will use get_page_children() function.

Please see this link for reference


share|improve this answer

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.