WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#13482 closed defect (bug) (fixed)

With global terms enabled, Nav Menu term_id saves as 0

Reported by: ev3rywh3re Owned by: wpmuguru
Milestone: 3.0 Priority: high
Severity: blocker Version: 3.0
Component: Menus Keywords: multsite
Focuses: Cc:

Description

I guess I will get bitten by the most obscure WordPress bugs ever. I'm also prone to try something stupid. :P

I've set up a WordPress MS site at http://funroe.net running in sub-directory mode. For some reason menus do not work on sub-directory MS site at http://funroe.net/projects. Every time you make a menu and save the the term_id would become 0. This causes all menus to break completely.

Of course I suspected some database corruption since this site is old and a WPMU convert that has been running of trunk for a while. To clean it out as much as I could I even did an WordPress export and import to another site running in a subdirectory at http://work.funroe.net/wpmu_t/converter/ the WP MS root is at http://work.funroe.net/wpmu_t/. Menus work as expected.

Converted and moved the DB tables back to the Main site at http://funroe.net/projects and the menus will revert to term_id 0 on save. The DB autoindex looks good and initial creation seems fine, but something tricks the custom taxonomy to go to 0.

This seems to only occur on a domain using multisite sub-directory mode on the root directory. WordPress multisite in sub-directory mode in a sub-directory seems to work fine. This is the case for all sub-sites even new ones.

I'm going to try to test this issue on a fresh install of a root domain somewhere as soon as I get time.

Change History (15)

comment:1 follow-up: nacin4 years ago

Sounds like you're running global terms, perhaps?

comment:2 in reply to: ↑ 1 ev3rywh3re4 years ago

Yes indeed! Completely forgot about goofing around with that. Disabling the "Global Terms" under "Super Admin > Options" fixes the issue. I'm sure others are going encounter this piece of nasty. It really does a number on your DB since the nav_items and taxonomies are all there, but completely broken.

comment:3 nacin4 years ago

  • Severity changed from critical to blocker

comment:4 ryan4 years ago

  • Summary changed from Multisite sub-directory mode in root directory Nav Menu term_id saves as 0 killing menu to With global terms enabled, Nav Menu term_id saves as 0

comment:5 ryan4 years ago

Updated the summary to reflect global terms as the culprit.

comment:6 ryan4 years ago

Note that if you toggle global terms back and forth, strange things can result.

comment:7 ryan4 years ago

If the global terms setting has changed, you'll need to delete existing menus and recreate them. They only way I've been able to reproduce this is to enable global_terms() after menus have been created.

comment:8 ryan4 years ago

If you've been running trunk for awhile and testing menus the whole time, there could also be some garbage laying around. Try deleting all menus and recreating and see if that helps.

comment:9 ryan4 years ago

  • Keywords reporter-feedback added

This may simply be an issue of needing a bigger warning on the global terms option. See #12666.

comment:10 wpmuguru4 years ago

There may be a ghost in the global terms somewhere. It may take a while to track down, so I would prefer we didn't hold back the RC on account of this one. I will look at this this week.

comment:11 ryan4 years ago

At one point I got into the situation where saving a menu resulted in bouncing back and forth between two terms, one with foo-2 as a slug and one with foo-3 as a slug. I've seen this before when switching global terms on without re-syncing terms.

comment:12 wpmuguru4 years ago

(In [14872]) ensure unique term_id when global terms enabled, see #13482

comment:13 wpmuguru4 years ago

  • Keywords reporter-feedback removed

@Ryan - That's half the problem. The remaining issue is that the relationship between the menu item and the menu is being deleted.

When the name/description of the menu is edited, the global terms assigns the term a new ID & updates the relationships to reflect the new id. Somewhere subsequent to that, the relationships are deleted.

I suspect the nav menu code has an issue when the menu id returned from the term update is different than the id passed in.

comment:14 nacin4 years ago

  • Owner set to wpmuguru
  • Status changed from new to assigned

comment:15 wpmuguru4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

fixed r15042

Note: See TracTickets for help on using tickets.