1

Running WP 3.9.1

I've got lots of pages and sub pages.

When I get to create menu lots of sub pages doesn't display on the right level, but some do?

This is how the pages metabox is displayed

The pages metabox should display something more like this


EDIT

Number in screenshot are a bit screwed sorry about that.

The problem is after the first few all the pages are displayed on the same level but they shouldn't.

It should look like this

  • Page 1
    • SubPage A of Page 1
    • SubPage B of Page 1
      • SubPage 1 of SubPage B
      • SubPage 2 of SubPage B
      • SubPage 3 of SubPage B
  • Page 2
    • SubPage A of Page 2
      • SubPage 1 of SubPage A
      • SubPage 2 of SubPage A
    • SubPage B of Page 2
      • SubPage 1 of SubPage B
      • SubPage 2 of SubPage B

...


Any idea what cause this or how to fix it, so i can manage my menu?

  • try to deactivate all plugins and return to default theme and check if it solves the problem. – Mark Kaplun Jul 28 '14 at 15:12
  • Just retested deactivating all plugins and activate the default theme, still have the same problem. – pyverret Jul 28 '14 at 15:22
  • there should be a scroll bar that lets you scroll in the list. maybe it is some problem with your browser. – Mark Kaplun Jul 28 '14 at 15:38
  • I can scroll fine. Just tested it with chrome, firefox, safari on mac and ie on pc. – pyverret Jul 28 '14 at 15:56
  • then it is totally not clear what are you asking about – Mark Kaplun Jul 28 '14 at 17:22
1

Found a fix.

Seems pagination is breaking the display of the the Pages hierarchy in the metabox.

Here is the fix to disable page pagination in the nav menu metabox

https://core.trac.wordpress.org/attachment/ticket/18282/18282-disable-nav-menu-pagination.patch

Thanks

1

The previous answers propose editing core WordPress files, which is never a good idea, as new versions of WordPress will overwrite the changes (among other things).

While the original Trac ticket #18282 has been open since July 2011, the issue still exists in WordPress 4.6 — going on 5+ years now.

Fortunately there is a "safe" way of implementing a workaround to change the behavior without hacking WordPress core.

Sergey Biryukov, a core committer, wrote a small feature plugin that changes the Pages metabox behavior and preserves the hierarchy for both post types and taxonomies:

Preserve Page and Taxonomy Hierarchy on Edit Menus Screen

The plugin only affects the "View All" tab, not "Most Recent" or "Most Used", but is a much more maintainable and responsible solution than patching core or hacking the files directly.

0

This is my implementation of the solution mentioned above, updated for Wordpress 4.6.1

In the file wp-admin/nav-menu.php edit the function wp_nav_menu_item_post_type_meta_box adding the argument 'nopaging' to the array starting at line 319 as follows:

$args = array(
    'offset' => $offset,
    'order' => 'ASC',
    'orderby' => 'title',
    'posts_per_page' => $per_page,
    'post_type' => $post_type_name,
    'suppress_filters' => true,
    'update_post_term_cache' => false,
    'update_post_meta_cache' => false,
    'nopaging' => true // add this argument
);

This will disable the pagination in the meta box and the pages hierarchy should show correctly, even if you have a long list of pages.

Hope it helps someone!

0

Here's a fix that you can apply in your own theme's functions.php:

add_filter( 'nav_menu_meta_box_object', 'disable_pagination_in_menu_meta_box', 9 );

function disable_pagination_in_menu_meta_box($obj) {
  $obj->_default_query = array(
    'posts_per_page' => -1
  );
  return $obj;
}

Update: Needs to be added with priority 9 to work well with the default filter _wp_nav_menu_meta_box_object

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.