Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 4 years ago

#35213 closed enhancement (fixed)

Pass object ids to filters in wp_delete_term()

Reported by: obenland's profile obenland Owned by: obenland's profile obenland
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

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 8 years ago.
35213.2.diff (6.0 KB) - added by obenland 8 years ago.
35213.3.diff (6.2 KB) - added by obenland 8 years ago.
Updated WpDeleteTerm tests with stricter assertion

Download all attachments as: .zip

Change History (8)

@obenland
8 years ago

#1 @obenland
8 years ago

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

@obenland
8 years ago

#2 @obenland
8 years ago

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

@obenland
8 years ago

Updated WpDeleteTerm tests with stricter assertion

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


8 years ago

#4 @obenland
8 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
8 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.