I'm wanting to find a way to have all pages listed without paging and to do so in a method that isn't going to be over-written when I update WordPress, i.e. in the form of a hook.

The page is in the administration:
all pages

With all the pages being listed I can then use javascript to do collapsing to show/hide subpages, I'm not phased about load times of the page or anything, just cant have this method usable if paging is also used, all pages need to be listed on 1 page.

As I'm wanting to do this in the admin area, I'm not even sure if this is do-able without breaking when updating.

  • I'm really curious about the method you are using to expand/collapse the subpages using the default screen wp-admin/edit.php?post_type=page. Is that possible? I'm not seeing useful classes or ID's in the markup...
    – brasofilo
    Jan 9 '13 at 2:11
  • You can identify subpages by the "-" at the start of the page name, double dashes for sub-subpages etc..
    – dakine
    Jan 9 '13 at 19:06

If that listing has too many pages, maybe you'll run into troubles.

You probably already know that this can be set in the Screen Options of the page http://example.com/wp-admin/edit.php?post_type=page.

If you try to put a really high value there, this warning pops up and the system doesn't accept it:

1500 pages

But the following permanently sets this value to 2000.
I don't have more than 999 pages to test if that limit that WordPress is warning about will be overriden or not, but the 2k shows up after refreshing the page, and keeps there if you try to lower it.

add_filter( 'get_user_metadata', 'pages_per_page_wpse_23503', 10, 4 );
function pages_per_page_wpse_23503( $check, $object_id, $meta_key, $single )
    if( 'edit_page_per_page' == $meta_key )
        return 2000;

    return $check;
  • I thought it would be much more complicated, but yes, Screen Options did it. I think that area should always be the first place I look - kinda like checking if you have gas in your non-running engine before you look into it further. ;)
    – Mark
    Mar 26 '15 at 20:13

You can create a new page template, and in that template put:

<?php wp_list_pages( 'depth=-1' ); ?> 

That will list all the pages with no indentation in alphabetical order.

(Reference: wp_list_pages)

  • Sorry I seemed to have completely forgotten to mention the main part of this, I'm wanting to do this in the admin area, thats why im unsure if I'll be breaking future updates
    – dakine
    Jul 21 '11 at 4:03
  • You can still do what Gavin suggested. Just the wp_list_pages call within a callback for your options page or wherever you'd like it. Aug 21 '11 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.