Make WordPress Core

Opened 6 years ago

Last modified 2 hours ago

#18282 reviewing defect (bug)

Issue with admin page hierarchy in Menu admin

Reported by: hcceast Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 3.2.1
Component: Menus Keywords: needs-patch
Focuses: Cc:


Under Appearance > Menus in the left column under Pages, if I have more than 50 pages, the hierarchy view gets messed up. The issue seems to be related to paginate.

If I change the "50" on lines 589 and 809 of wp-admin/includes/nav_menu.php to "955" the hierarchal admin menu works with 50+ pages.

Attached are two XML files. One contains 50 pages and the other contains 53 pages. I've loaded them into fresh installs of 3.2.1 using the twenty eleven theme and no plugins.

Paginate is great if it works right, if it won't work, just increase the number per page to something very high and people can scroll. I'd rather scroll than not have hierarchy work right.

Link to 50 page XML -- http://cloud.hcc.me/0g3X3O310s3l3i2N363n

Link to 53 page XML -- http://cloud.hcc.me/302e0c391A14193m2V2e

Pastebin of wp-admin/includes/nav_menu.php -- http://pastebin.com/0FRAmMkS

Attachments (4)

page xml .zip (7.1 KB) - added by hcceast 6 years ago.
XML Page Files
Screen shot 2011-07-28 at 10.03.43 AM.png (30.6 KB) - added by hcceast 6 years ago.
Screen shot of admin menu (all subs should be under parents)
18282-disable-nav-menu-pagination.patch (621 bytes) - added by Aries-Belgium 4 years ago.
Patch to work around nav menu pagination
preserve-page-and-taxonomy-hierarchy.php (1.9 KB) - added by SergeyBiryukov 3 years ago.

Download all attachments as: .zip

Change History (46)

6 years ago

XML Page Files

6 years ago

Screen shot of admin menu (all subs should be under parents)

#2 @SergeyBiryukov
5 years ago

Taxonomies are also affected.

Closed #19837 and #20351 as duplicates.

#3 @Marventus
5 years ago

  • Cc frandeazevedo@… added

#4 @Marventus
5 years ago

I suspect the $depth parameter could be failing during pagination.

I'll take a look into it see if I can find anything.

Version 0, edited 5 years ago by Marventus (next)

#5 @Whissi
5 years ago

  • Cc Whissi added
  • Version changed from 3.2.1 to 3.3.2

Is anybody working on this? The current release (3.3.2) is still affected.

#6 @JustinSainton
5 years ago

  • Version changed from 3.3.2 to 3.2.1

The version tag is used for when the issue was introduced, not the most recent version it occurs in.

#7 @dmaras
5 years ago

  • Version changed from 3.2.1 to 3.4


i cant find this line in version 3.4 and i have same issue...

I have it i was looking in wp-includes/nav-menu.php

Last edited 5 years ago by dmaras (previous) (diff)

#8 @SergeyBiryukov
5 years ago

  • Version changed from 3.4 to 3.2.1

Version number indicates when the bug was initially introduced/reported.

#9 @SergeyBiryukov
4 years ago

#23286 was marked as a duplicate.

#10 @SergeyBiryukov
4 years ago

  • Owner Andrew Smith deleted
  • Status changed from new to reviewing

#11 @energy0m
4 years ago

  • Cc marc@… added
  • Severity changed from major to blocker

When is this ticket going to be resolved? is there a patch? This is core functionality keeping my project from launching which is over 18months old. not cool. I can put in pages manually but my client cant manage them and as it turns out they have a very deep sitemap to place in the menu's section.

so again.. when is this to be resolved?

#12 @Marventus
4 years ago

  • Severity changed from blocker to major

@energy0m: the issue will be resolved when... someone takes the time to resolve it. It seems Sergey is looking into it, but if you are in a rush, I suggest you contact him and - here's a crazy idea! - offer him to help. In the meantime, I can only suggest you take a chill pill and read up on what Open Source is all about: http://en.wikipedia.org/wiki/Open_source.

#13 @energy0m
4 years ago

How can I help him when I don't know enough about PHP to resolve the problem?

#14 @SergeyBiryukov
4 years ago

I'm not actually looking into it yet, I've just removed the previous owner so that someone else could take over this ticket. Feel free to submit a patch.

#15 @helen
4 years ago

This is essentially a visual bug - the hierarchy is not actually altered, and since nav menus specifically do not rely on the page hierarchy, nothing is broken beyond the visual. Yes, it is a bug and yes, it is frustrating, but it shouldn't be something that holds up a launch.

#16 @SergeyBiryukov
4 years ago

#24436 was marked as a duplicate.

#17 @allergicvegetarian
4 years ago

This issue also effects categories as well, when you are creating a menu. I'm making a navigation menu that isn't on a specific page.

Obviously, this isn't going to get fixed soon, given a computer programmers time for open source projects is directly related to the amount of extra work their real job requires them to program "for free" under the heading of "salaried" (work 60 hours, get paid for 40). LOL I fully support the Computer Programmer in this, and in no way, am I dissing the programmer. I'm also against such abuse of programmers.

Last edited 4 years ago by allergicvegetarian (previous) (diff)

4 years ago

Patch to work around nav menu pagination

#18 @Aries-Belgium
4 years ago

The issue is indeed the pagination that breaks the hierarchy of the pages. It's possible that some child pages aren't on the same page/section than the parent page which confuses the Walker.

In the attachment a patch for a quick workaround by disabling the pagination for the "All"-tab. When I find the time I will see if I can come up with a solution where the pagination doesn't break the hierarchy but for now this patch also works.

#19 @Aries-Belgium
4 years ago

  • Cc Aries-Belgium added

#20 @moraleida.me
4 years ago

  • Cc moraleida.me added

#21 @SergeyBiryukov
4 years ago

#25262 was marked as a duplicate.

#22 @alettieri
4 years ago

  • Cc alettieri added

#23 @SergeyBiryukov
3 years ago

#27143 was marked as a duplicate.

#24 follow-up: @davidfhannes
3 years ago

I tried the patch to no avail:

	$posts = $get_posts->query( array_merge( $args, array( 'nopaging' => true ) ) ); 

I really need assistance on this issue. This is my issue at hand:

Screen shot:

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

#25 in reply to: ↑ 24 @SergeyBiryukov
3 years ago

Replying to davidfhannes:

I tried the patch to no avail:

That patch is for pages (and other hierarchial post types), not for taxonomies.

I've created a workaround plugin to preserve hierarchy for both post types and taxonomies:

Note that it only affects "View All" tab, not "Most Recent" or "Most Used".

#26 @SergeyBiryukov
3 years ago

#28031 was marked as a duplicate.

#27 @apsolut
3 years ago

I like @SergeyBiryukov fix! thumbs up!

#28 @SergeyBiryukov
3 years ago

#29252 was marked as a duplicate.

#29 @SergeyBiryukov
3 years ago

#30122 was marked as a duplicate.

#30 @energy0m
3 years ago

@SergeyBiryukov ... you rock!

#31 @SergeyBiryukov
3 years ago

#30992 was marked as a duplicate.

#32 @chunkysteveo
2 years ago

Great little patch plugin @SergeyBiryukov, solved my head bashing!

#33 @m7csat
2 years ago

Just wanted to add my thanks! Solved my frustrations.

#34 @p10design
2 years ago

Is there a reason why this was never fixed?
Why is there a plugin to fix a core functionality?
What are the steps one should take to get this issue to be fixed?


#35 @majemedia
20 months ago

For larger sites that have a massive number of pages this is causing issues. The steps in the original description properly duplicate this.

The plugin by @SergeyBiryukov works as designed, but when you're dealing with a large number of pages (> 500) the nav menu page takes a long time.

The patch by @Aries-Belgium run into the same load time issues.

#36 @sjlevy
14 months ago

I can confirm that this is still an issue with 4.5.2

@SergeyBiryukov 's plugin works by eliminating pagination under 'View All'

#37 @xavierserranoa
3 months ago

i have been looking into this. the only solution i could present for this scenerio is to have the walker or the query results $post variable be handled the same way it is handled by class-wp-posts-list-table look at _display_rows_hierarchical and _page_rows. this way the displaying of the posts will work with pagination. still kind of testing it out and seeing what could be done would love help or pointers if anyone has any.

#38 @SergeyBiryukov
8 weeks ago

#40880 was marked as a duplicate.

#39 @SergeyBiryukov
4 days ago

#40827 was marked as a duplicate.

#40 @raykaii
4 days ago

Is there a reason why this was never fixed?

This bug is also affecting Woocommerce in a Bad way.

As you can see at the ticket https://core.trac.wordpress.org/ticket/40827 and the ticket at Woocommerce at https://github.com/woocommerce/woocommerce/issues/13040 Woocommerce devs did comment saying this bug is affecting Woocommerce too.

Would be nice to have a real fix and a fix that would work with Woocommerce.

Last edited 4 days ago by raykaii (previous) (diff)

#41 follow-up: @torndownunits
3 hours ago

I can't believe this is still an issue, but thank you @SergeyBiryukov for the fix. as @raykaii said, it's a complete pain with WooCommerce.

#42 in reply to: ↑ 41 @raykaii
2 hours ago

Replying to torndownunits:

I can't believe this is still an issue, but thank you @SergeyBiryukov for the fix. as @raykaii said, it's a complete pain with WooCommerce.

hey if you could complain about at WooCommerce it mite help WC devs could fix it if ppl complain about it. Do it here: https://github.com/woocommerce/woocommerce/issues/13040

Note: See TracTickets for help on using tickets.