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 "Default Page Generator" on theme activation i have created...
in that file i set 'menu_order' for each page.

i want to exclude pages with menu order bigger then 50 from the default wp_list_pages menu

Is there a way to check for / retrieve 'menu_order' of each page? and if there is can you think of a way to intergrate it into the wp_list_pages function?

share|improve this question
up vote 2 down vote accepted

Declare the following function in your functions.php

function wpse58346_wp_list_pages( $pages, $r ) {
    foreach( $pages as $key => $page ) {
        if ( 50 < $page->menu_order )
    return $pages;

Now before calling wp_list_pages() apply a filter as follows

add_filter('get_pages', 'wpse58346_wp_list_pages', '', 2);

And after you have called wp_list_pages() you can remove the filter so that it doesn't mess with some other funcctionality

remove_filter('get_pages', 'wpse58346_wp_list_pages');
share|improve this answer
gr8 job man... easy to implement and easy to use - thanks :) – Sagive SEO Aug 1 '12 at 21:39

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.