Opened 13 years ago
Last modified 14 months ago
#18282 reopened defect (bug)
Issue with admin page hierarchy in Menu admin
Reported by: | hcceast | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | critical | Version: | 3.2.1 |
Component: | Menus | Keywords: | needs-patch needs-screenshots changes-requested |
Focuses: | Cc: |
Description
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)
Change History (84)
#4
@
13 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.
#5
@
12 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
@
12 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
@
12 years ago
- Version changed from 3.2.1 to 3.4
hello,
i cant find this line in version 3.4 and i have same issue...
Edit:
I have it i was looking in wp-includes/nav-menu.php
#8
@
12 years ago
- Version changed from 3.4 to 3.2.1
Version number indicates when the bug was initially introduced/reported.
#11
@
12 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
@
12 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.
#14
@
12 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
@
12 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.
#17
@
11 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.
#18
@
11 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.
#24
follow-up:
↓ 25
@
11 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: http://162.144.54.1/wp-content/uploads/ss_reply_to_Jody_2-16-14.jpg
#25
in reply to:
↑ 24
;
follow-ups:
↓ 47
↓ 67
↓ 68
↓ 79
@
11 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:
preserve-page-and-taxonomy-hierarchy.php.
Note that it only affects "View All" tab, not "Most Recent" or "Most Used".
#34
@
9 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?
Thanks!
#35
@
9 years 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
@
8 years 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
@
7 years 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.
#40
@
7 years ago
Hi,
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.
#41
follow-up:
↓ 42
@
7 years 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
@
7 years 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
#43
follow-up:
↓ 44
@
7 years ago
@torndownunits did the temp fix work for WC ? it's not working for me.
#44
in reply to:
↑ 43
;
follow-up:
↓ 46
@
7 years ago
Replying to raykaii:
@torndownunits did the temp fix work for WC ? it's not working for me.
Yes, I used the plugin from post #25. It's not ideal but it makes the Product Categories hierarchy at least display correctly in Appearance--> Menus (using View All) which is what I needed. It was a mess before, and now the hierarchy of everything is at least correct. Using the editor with dozens (never mind hundreds) of items is a pain still, but I can use it. Also, I ended up here from your posts at Woo. But isn't this a problem with all items in the Menu editor, not just Woo items? The editor basically is just horrible when dealing with dozens (never mind hundreds) of options in general.
#46
in reply to:
↑ 44
;
follow-up:
↓ 49
@
7 years ago
- Keywords needs-screenshots added
Replying to torndownunits:
Replying to raykaii:
@torndownunits did the temp fix work for WC ? it's not working for me.
Yes, I used the plugin from post #25. It's not ideal but it makes the Product Categories hierarchy at least display correctly in Appearance--> Menus (using View All) which is what I needed. It was a mess before, and now the hierarchy of everything is at least correct. Using the editor with dozens (never mind hundreds) of items is a pain still, but I can use it. Also, I ended up here from your posts at Woo. But isn't this a problem with all items in the Menu editor, not just Woo items? The editor basically is just horrible when dealing with dozens (never mind hundreds) of options in general.
woocommerce (mikejolley) said they could fix it but i was the only one complaining about it. they need more ppl reporting it so they take the time to fix it. plz, ask them to fix this bug or it never going to be fixed :(.
#47
in reply to:
↑ 25
;
follow-up:
↓ 48
@
7 years ago
Replying to SergeyBiryukov:
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:
preserve-page-and-taxonomy-hierarchy.php.
Note that it only affects "View All" tab, not "Most Recent" or "Most Used".
So where do we add this file to?
#48
in reply to:
↑ 47
@
7 years ago
Replying to raykaii:
Replying to SergeyBiryukov:
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:
preserve-page-and-taxonomy-hierarchy.php.
Note that it only affects "View All" tab, not "Most Recent" or "Most Used".
So where do we add this file to?
Make a folder inside your plugins folder. Put the file in it. Go into your dashboard, go to plugins, activate it. You will see it listed in your plugins.
#49
in reply to:
↑ 46
@
7 years ago
Replying to raykaii:
Replying to torndownunits:
Replying to raykaii:
@torndownunits did the temp fix work for WC ? it's not working for me.
Yes, I used the plugin from post #25. It's not ideal but it makes the Product Categories hierarchy at least display correctly in Appearance--> Menus (using View All) which is what I needed. It was a mess before, and now the hierarchy of everything is at least correct. Using the editor with dozens (never mind hundreds) of items is a pain still, but I can use it. Also, I ended up here from your posts at Woo. But isn't this a problem with all items in the Menu editor, not just Woo items? The editor basically is just horrible when dealing with dozens (never mind hundreds) of options in general.
woocommerce (mikejolley) said they could fix it but i was the only one complaining about it. they need more ppl reporting it so they take the time to fix it. plz, ask them to fix this bug or it never going to be fixed :(.
I didn't see them say they'd fix anything? They said it's a problem with Wordpress, which it is. It's not specifically a problem with Woo taxonomies, it's a problem with all taxonomies. It's not really their problem to fix.
#50
follow-up:
↓ 54
@
7 years ago
"Make a folder inside your plugins folder. Put the file in it. Go into your dashboard, go to plugins, activate it. You will see it listed in your plugins."
AND.... DOWNLOAD the file above ... DO NOT copy/paste the code into a text file, saved it, uploaded it, and it didn't work.
HOWEVER ... when I Select All and add (Product Categories) it doesn't add them all ... 130 out of 241 menus.
#51
follow-up:
↓ 64
@
7 years ago
I found a somewhat simpler (more targeted) solution to disable pagination in these meta boxes, by placing a filter on the nav_menu_meta_box_object
hook:
<?php add_filter( 'nav_menu_meta_box_object', array( $this, 'disable_pagination_in_menu_meta_box' ) ); function disable_pagination_in_menu_meta_box($obj) { $obj->_default_query = array( 'posts_per_page' => -1 ); return $obj; } ?>
Please be advised that this uses the private-looking _default_query
, so your mileage may vary, but it worked very well for me.
#52
follow-up:
↓ 53
@
7 years ago
Update: Needs to be added with priority 9 to work well with the default filter _wp_nav_menu_meta_box_object
. Corrected line below:
<?php add_filter( 'nav_menu_meta_box_object', 'disable_pagination_in_menu_meta_box', 9 );
#53
in reply to:
↑ 52
@
7 years ago
Replying to danburzo:
Update: Needs to be added with priority 9 to work well with the default filter
_wp_nav_menu_meta_box_object
. Corrected line below:
<?php add_filter( 'nav_menu_meta_box_object', 'disable_pagination_in_menu_meta_box', 9 );
Thanks, I will try this out.
#54
in reply to:
↑ 50
;
follow-up:
↓ 55
@
7 years ago
Replying to randNotAyn:
"Make a folder inside your plugins folder. Put the file in it. Go into your dashboard, go to plugins, activate it. You will see it listed in your plugins."
AND.... DOWNLOAD the file above ... DO NOT copy/paste the code into a text file, saved it, uploaded it, and it didn't work.
HOWEVER ... when I Select All and add (Product Categories) it doesn't add them all ... 130 out of 241 menus.
I am not sure how many it's working with successfully on my site, but it's not as many as you are trying it with for sure. I am going to try out the solution just added by @danburzo as well. See if one works better than the other.
#55
in reply to:
↑ 54
@
7 years ago
Replying to torndownunits:
Thank you for helping!
If you'd like access to my site let me know and I can email credentials (it's at a temp site).
#56
@
7 years ago
I just wanted to add an update that I am also experiencing this issue and my site has nowhere near 500 pages. I have 71 total pages. This is a site for a school, so I have many pages added as children of a main "Schools" page. The fact that the parent starts with an 'S' causes the majority of the children to appear as top-level items when pagination is enabled (not in alpha order, either.)
Adding the filter @danburzo suggested worked perfectly.
#57
@
6 years ago
Hi,
I am having similar issue on my site when using woocommerce.
I am having around 150 categories and I can't see the product category hierarchy right.
any fix for that?
thanks.
#58
@
6 years ago
I had the same issue,
Tried all kinds of solutions.
The one that worked for me was to download this plugin and activate
https://core.trac.wordpress.org/attachment/ticket/18282/preserve-page-and-taxonomy-hierarchy.php
You can see the download button at the bottom of the page.
You then need to create a folder in your plugins folder and place this file in there.
Everything was perfect for me after that.
#59
@
6 years ago
Hello
i am using the plugin > preserve page and taxonomy hierarchy. It works well (thanks), but all of a sudden it is not giving me all the product categories i have created (not listing all of them in the add to menu section under view all).. there is alot, over 900 product categories and counting... Please help as i cant seem to find a work around. It will be impossible for me(ie take to long so i wont do it) to add those many items to the menu in their respective sub categories.
I have also tried @danburzo advice but unfortunately it did not work for me.
Please help
#60
@
6 years ago
While this issue relates to WordPress, my interest is with WooCommerce.
For WooCommerce users who have a large number of Product Categories, the patch provided by @SergeyBiryukov will stop working after a certain number.
The patch essentially removes pagination. However once you get "too many" categories you may end up with a blank nav-pages.php page without any error showing in site error logs. Your only option is to then remove the patch. (If I eventually find server settings that will allow it to run I will repost but our test show it fails around 2500 categories).
It is naive of @helen to say that this fundamental defect in WordPress should not stop a site going live. Being able to create specific menus for ecommerce is a must in order to provide customers with a unique customer experience. If you have over 2000 categories, many with duplicate names as happens on many eCommerce sites, you cannot distinguish category names if the category list does not show the hierarchy. Being able to see the hierarchy in a paginated view is a must.
It would be good if the WP team took the issue seriously.
#62
@
5 years ago
@flyingkites can be.
But after all this year a experience the same problem and the fix helped.
Very strange it still exists.
#63
@
4 years ago
Sad this is still an issue. Big stores need big menus and this creates big problems for us!
#64
in reply to:
↑ 51
@
4 years ago
Hello,
I am kinda new to wordpress and am building an online store by the help of different videos.
Can you please explain where and how to add this code?
I would really appreciate if anyone could help me out.
Thanks
Replying to danburzo:
I found a somewhat simpler (more targeted) solution to disable pagination in these meta boxes, by placing a filter on the
nav_menu_meta_box_object
hook:
<?php add_filter( 'nav_menu_meta_box_object', array( $this, 'disable_pagination_in_menu_meta_box' ) ); function disable_pagination_in_menu_meta_box($obj) { $obj->_default_query = array( 'posts_per_page' => -1 ); return $obj; } ?>Please be advised that this uses the private-looking
_default_query
, so your mileage may vary, but it worked very well for me.
#66
@
4 years ago
Thanks @Baroninn this temporarily fix my issue
why nothing is done to fix problem in the core? :/
#67
in reply to:
↑ 25
@
4 years ago
Replying to SergeyBiryukov:
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:
preserve-page-and-taxonomy-hierarchy.php.
Note that it only affects "View All" tab, not "Most Recent" or "Most Used".
Thanks! That worked for me
#68
in reply to:
↑ 25
@
4 years ago
- Resolution set to worksforme
- Status changed from reviewing to closed
It works like a lifesaver. Thanks for that. You'd make it as a plugin and submit it in the repo. It took almost 2 days for me to find the solution. A plugin will help all who have less technical concepts.
Replying to SergeyBiryukov:
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:
preserve-page-and-taxonomy-hierarchy.php.
Note that it only affects "View All" tab, not "Most Recent" or "Most Used".
This ticket was mentioned in Slack in #core by danburzo. View the logs.
4 years ago
#70
@
4 years ago
- Resolution worksforme deleted
- Status changed from closed to reopened
Re-opening ticket, as it was unintentionally closed before a resolution was reached.
#71
@
4 years ago
Great thanks to @SergeyBiryukov for the patch preserve-page-and-taxonomy-hierarchy.php
It works well and keeps the hierarchy of all my 83 woocommerce product categories when trying to add them to a menu.
Unfortunately in the Appearance--> Menus (using View All) there are all the product categories being re-sorted alphabeticaly! Is it possible to keep the original sorting order of the product categories as well, together with keeping the hierarchy?
Thanks!
#73
@
2 years ago
After hour off searching, found this very old bug report.
11 years later, still a issue and fixed by the custom plugin. Very strange.
#74
follow-up:
↓ 76
@
21 months ago
A very difficult bug. In 2023, the developers are still trying to fix it.
#75
@
21 months ago
- Keywords changes-requested added
The request for it is open in 2017. It still exist in 2023 I spend my whole day still couldn't solve it. It's very sad to know that there is now fix for it.
#76
in reply to:
↑ 74
;
follow-up:
↓ 78
@
21 months ago
Replying to DownHouse00:
A very difficult bug. In 2023, the developers are still trying to fix it.
Did you get any solution?
#77
in reply to:
↑ 72
@
21 months ago
- Severity changed from major to critical
Replying to SergeyBiryukov:
#52580 was marked as a duplicate.
Please test your patch with latest version of wordpress. It's not working for me.
#78
in reply to:
↑ 76
@
21 months ago
Replying to fatima656:
Replying to DownHouse00:
A very difficult bug. In 2023, the developers are still trying to fix it.
Did you get any solution?
Yes. This plugin work for me with last version of wp
https://github.com/IftekharSami/Preserve-Page-and-Taxonomy-Hierarchy-on-Edit-Menus-Screen-Version-0.1-Plugin-/blob/main/code
#79
in reply to:
↑ 25
@
20 months ago
Replying to SergeyBiryukov:
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:
preserve-page-and-taxonomy-hierarchy.php.
Note that it only affects "View All" tab, not "Most Recent" or "Most Used".
This plugin/patch still works as of WordPress 6.1. However, how is this issue still a thing in 2023? This is just bad UX and causes confusion when building menus. Been chasing this down for a week before finally stumbling on this and luckily the plugin works to where I can feel confident with handing over a project to a client.
XML Page Files