Make WordPress Core

Opened 13 years ago

Closed 10 years ago

Last modified 10 years ago

#19205 closed defect (bug) (fixed)

Orphaned categories can be created by accident

Reported by: dzver's profile dzver Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.0 Priority: normal
Severity: minor Version:
Component: Taxonomy Keywords: has-patch needs-unit-tests
Focuses: Cc:


There are two ways to do that.

  1. You can work on category tree from two browser windows.
  • In window one, delete a category
  • In window two, add a child to the category that has been deleted.

wp_insert_term needs to check if the parent exists.

  1. If you delete a couple of categories with bulk-delete, a third level child node can become orphan.

wp_delete_term uses get_term to find the parent node and can retrieve cached data.

Attachments (1)

19205.diff (625 bytes) - added by dlh 11 years ago.

Download all attachments as: .zip

Change History (6)

11 years ago

#2 @dlh
11 years ago

  • Keywords has-patch added

Diff attempts to address issue (1). After the $args are parsed, checks term_exists() if needed.

#3 @wonderboymusic
10 years ago

  • Keywords needs-unit-tests added
  • Milestone changed from Awaiting Review to 4.0

We should inspect this with unit tests

#4 @wonderboymusic
10 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 29196:

Avoid a race condition when multiple windows are open so that orphaned terms cannot be created by accident.

Adds a unit test.

Props dlh.
Fixes #19205.

#5 @SergeyBiryukov
10 years ago

In 29234:

Use an existing string.

see #19205.

Note: See TracTickets for help on using tickets.