I have over 800 pages in WordPress which becomes a challenge trying to find a specific page to add it to the menu. View all works if you have only a few pages so the best option would be to search for the page to add it to the menu. The problem is that the search result only brings up 10 pages, I need it to return more results (say 30) so I can find the page that I am looking for, the page that I am looking for might be result number 22 but I can't find it because it is not displayed, hope this makes sense.

Just a reminder that I want to increase the search results for "Admin -> Appearance -> Menus -> Search" and not "Admin -> Pages -> Search"

Any body can help me with what code to add to the functions.php file to increase the search results?

Thank you in advance Tony

  • I dont understand.. (sorry) - do you means the regular search results displayed after you enter a search query only returns 10 results and you have "next" "previus" buttons?
    – Sagive
    Commented Mar 28, 2012 at 16:01
  • Hi Sagive SEO. @Sagive SEO Thanks for getting back to me "Admin -> Appearance -> Menus -> Search" only gives 10 results by default, there isn't a next or previous button as when you do a regular search in the admin area under "Admin -> Pages -> Search" See image attached:[link] (dontremove.s3.amazonaws.com/appearance-menus-search.png )
    – Tony
    Commented Mar 29, 2012 at 13:51

4 Answers 4


No need to change core files! Here is a hook (add in functions.php or simple plugin):

// filtering quick-menu-search results (this seems better than others at https://pastebin.com/raw/jRkJYAzE )
add_action( 'pre_get_posts', 'myFilter1', 10, 2 );
function myFilter1( $q ) {
    // example of $q properties: https://pastebin.com/raw/YK1uaE0M
    if(isset($_POST['action']) && $_POST['action']=="menu-quick-search" && isset($_POST['menu-settings-column-nonce'])){    
        // other parameters for more refinement: https://pastebin.com/raw/kZ7hwpyx
        if( is_a($q->query_vars['walker'], 'Walker_Nav_Menu_Checklist') ){
            $q->query_vars['posts_per_page'] =  30;
    return $q;

change 30 to whatever you want.

  • Still relevant in 2020.
    – Faye
    Commented Sep 8, 2020 at 19:59
  • 1
    so useful, just took me 30 minutes to find this because every Google search tried to teach me how to set up a search bar in WordPress. The basic sorting of the default search results SUCKS. I have a page called rewilding, with a slug called rewilding, and searching rewilding doesn't show it in the results. Thank you!
    – rtpHarry
    Commented Jan 19, 2022 at 16:45

I also needed this functionality, the answer is around line 330 in wp-admin/includes/nav-menu.php


'posts_per_page' => 10,


'posts_per_page' => 1000,

or whatever you'd like. Note you can also change the number of items under the other tabs in this file.

This applies to version 3.4.2 of wordpress.

  • Then you would be stuck at this WP version, because you cannot upgrade anymore without losing the changes. Not a good idea.
    – fuxia
    Commented Nov 8, 2012 at 16:59
  • Still, good enough for a temporary fix (just to get the menus established) if you're setting up nav for a site with hundreds of pages. The search functionality really doesn't work well and paginating through the 'View All' can take ages. Thanks John!
    – Michelle
    Commented Feb 4, 2013 at 23:24

ok... sorry - i have searched and as for now i cant find a way to hard code this option... hope someone of the many wordpress experts here would help reach a hard coded solution.

For now i would reccomend you use the built in Search capability of your browser to do a simple search for the desired name...

See Image:
enter image description here

  • Thanks for the feedback. I know what the URL is for the page but can't add it to the menu without finding it in the "Most Rent" "View All" or "Search" options in the "Admin -> Appearance -> Menus -> Search" first.
    – Tony
    Commented Mar 29, 2012 at 22:12
  • i think once on "view all" you can search using your internal broweser search using the page name and those find it easily... i think it would be just as fast and really the same as searching using wordpress..
    – Sagive
    Commented Mar 30, 2012 at 2:35
  • Thanks I tried it and it is a very us full trick I must say. On the "View All" tab WordPress will show 50 pages in a group then you need to select "<< 1 2 3 etc..." navigation to see the next group of pages. I use the browser's search function to highlight the pages that I need.
    – Tony
    Commented Mar 30, 2012 at 15:22

In the newer Wordpress version 4.9.5, it is line '80' in nav-menu.php.

To change the number of Wordpress menu pages search results (Admin > Appearance > Menus > Search) from 10 results to more go to:

wp-admin > includes > nav-menus.php > line '80' > 'posts_per_page' => 10,
Change the 10 to some other number.

This assumes you have a way to actually edit nav-menu.php. Or can change the permissions if need be so that you can edit. And yes, it also assumes you will need to re-implement if there is a Wordpress upgrade. But once you have your menu configured, it may not even be necessary after that. A default of 10 search results, is downright silly in my opinion. Some sites have hundreds, even thousands of posts or pages.

  • It is bad practice to change the WordPress source directly as you will either lose changes when updating it, or be forced to avoid updating WordPress. Commented Jun 26, 2018 at 1:27
  • I understand... that's why I clearly stated: "it also assumes you will need to re-implement if there is a Wordpress upgrade".
    – Heres2u
    Commented Sep 24, 2018 at 15:29

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.