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.

1 Answer 1


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


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.