Circular References in Categories
|Reported by:||interlock||Owned by:|
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!
- Make a category, let's say "Newsletters"
- Make a sub category, let's say "Newsletters Archive". Let's set the parent to "Newsletters"
- 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...)
Your category list no longer contains either entry now.
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."
Filter the parent selection when editing taxonomy entries to not include any children of the current entry. Should prevent most instances of this happening.