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 have a menu that is currently shown with wp_list_pages( 'title_li=' ); This shows all the sub pages from all the pages in the menu.

I want to exclude a page with id 56 from displaying its sub items.

When I use wp_list_pages( 'exclude=56&title_li=' ); the menu becomes huge and all over the page. When I use wp_list_pages( 'exclude=56' ); the menu gets messed up (vertical instead of horizontal (no li) and all of them are displayed.

How can I fix this?

share|improve this question

There's a filter called wp_list_pages_exclude that you could possibly hook into (put this in your functions.php):

function filter_wp_list_pages($exclude){
    $exclude[] = 56;
    return $exclude;

add_filter("wp_list_pages_excludes", "filter_wp_list_pages");
share|improve this answer

Try changing the exclude to exclude_tree, read more in the function parameters.

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.