WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#15157 closed defect (bug) (duplicate)

Circular References in Categories

Reported by: interlock Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: Taxonomy Keywords: category taxonomy
Focuses: Cc:

Description

Came across this with a client this morning.

Basically, it appears that hierarchical taxonomy entries can end up in circular references quite easily, since the list only appears to filter out the current term entry, not any possible children entries as well. The first symptom of this is that the taxonomy entries disappear from the menu once this occurs. Requiring you to manually edit the database and fix the parent references. Some plugins also have a very difficult time dealing with this, leading to unpredictable behaviours and possibly some data corruption.

Reproducing is easy!

  1. Make a category, let's say "Newsletters"
  2. Make a sub category, let's say "Newsletters Archive". Let's set the parent to "Newsletters"
  3. Let's go back and edit "Newsletters" and set the parent to "Newsletters Archive". (You ask yourself why you do this, but silently ignore the voice...)

Results:
Your category list no longer contains either entry now.

Expected Result:
Changing "Newletters" parent to "Newletters Archive" should result in a failure to save with a message about, "You cannot set the parent to a child of its self."

Fix:
Filter the parent selection when editing taxonomy entries to not include any children of the current entry. Should prevent most instances of this happening.

Change History (1)

comment:1 nacin4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

This is fixed in 3.1 at multiple levels.

Note: See TracTickets for help on using tickets.