WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 11 days ago

#35213 closed enhancement (fixed)

Pass object ids to filters in wp_delete_term()

Reported by: obenland Owned by: obenland
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch
Focuses: Cc:
PR Number:

Description

If a site has a large amount of posts associated with a term, custom queries hooked into delete_term or delete_$taxonomy can become very expensive. On WordPress.com we pass the affected object ids to the actions as well, allowing for a more targeted query.

Attachments (3)

35213.diff (2.7 KB) - added by obenland 4 years ago.
35213.2.diff (6.0 KB) - added by obenland 4 years ago.
35213.3.diff (6.2 KB) - added by obenland 4 years ago.
Updated WpDeleteTerm tests with stricter assertion

Download all attachments as: .zip

Change History (8)

@obenland
4 years ago

#1 @obenland
4 years ago

Also, $objects is the wrong variable name for this list. It should be $object_ids.

@obenland
4 years ago

#2 @obenland
4 years ago

  • Keywords has-patch added
  • Type changed from defect (bug) to enhancement

@obenland
4 years ago

Updated WpDeleteTerm tests with stricter assertion

This ticket was mentioned in Slack in #core by obenland. View the logs.


4 years ago

#4 @obenland
4 years ago

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

In 36080:

Taxonomy: Pass object ids to delete_* actions.

Allows for more targeted updates to affected posts in callbacks.
Disambiguates $objects variable and amends unit tests.

Fixes #35213.

#5 @DrewAPicture
4 years ago

In 36962:

Docs: Improve changelog entries added for the delete_term and delete_{$taxonomy} actions in [36080] and a third entry added for the clean_term_cache action in [36399]

See #35213, #35611. See #35986.

Note: See TracTickets for help on using tickets.