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?

1 Answer 1


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');
  • gr8 job man... easy to implement and easy to use - thanks :)
    – Sagive
    Commented Aug 1, 2012 at 21:39

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.