Make WordPress Core

Opened 4 years ago

Closed 15 months ago

Last modified 15 months ago

#19205 closed defect (bug) (fixed)

Orphaned categories can be created by accident

Reported by: dzver Owned by: 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 2 years ago.

Download all attachments as: .zip

Change History (6)

@dlh2 years ago

comment:2 @dlh2 years ago

  • Keywords has-patch added

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

comment:3 @wonderboymusic18 months ago

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

We should inspect this with unit tests

comment:4 @wonderboymusic15 months 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.

comment:5 @SergeyBiryukov15 months ago

In 29234:

Use an existing string.

see #19205.

Note: See TracTickets for help on using tickets.