Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I need to create a page in my site that I am able to access via url, but that won't be included in any of the navigation menus which are generated using wp_list_pages() on my site.

How can I accomplish this?

share|improve this question
    
Define menus?.. It can be pages widget, wp_list_pages function output, custom menu or something custom altogether. –  Rarst Sep 24 '10 at 20:08
    
Ahh. Good clarifying question. I have edited my answer. I mean using wp_list_pages() –  jessegavin Sep 24 '10 at 20:11
add comment

3 Answers

up vote 5 down vote accepted

There is a good plugin that adds a meta check box under all pages that indicates whether you want the page to show up in menus.

Exclude Pages Plugin

The other option is to convert from wp_list_pages to the new custom menus. When using custom menus only pages you add to the menu will be included.

share|improve this answer
add comment

You're in luck, there's a filter. See this line inside wp_list_pages():

$r['exclude'] = implode( ',', apply_filters('wp_list_pages_excludes', $exclude_array) );

So, just hook into wp_list_pages_excludes:

// add some new page ids to the exclude list
function my_banned_pages( $exclude_array ) {
    return array_merge( $exclude_array, array( 12, 45 ) ); 
}
add_filter( 'wp_list_pages_excludes', 'my_banned_pages' );
share|improve this answer
    
Works like a friggen charm! You rock! –  jessegavin Sep 24 '10 at 20:31
    
I changed my accepted answer to the actual answer I ended up using. Your answer is "correct" though. –  jessegavin Sep 25 '10 at 2:46
    
@jessegavin No sweat, glad you found a solution. :) –  Annika Backstrom Sep 25 '10 at 23:25
add comment

just pass a flag to the wp_list_pages function call. All you need to do is get the page ID you want to exclude. See the example on the codex page listed below. http://codex.wordpress.org/Function_Reference/wp_list_pages#Exclude_Pages_from_List

share|improve this answer
add comment

Your Answer

 
discard

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.