#52549 closed defect (bug) (fixed)
Optimize `wp_delete_term()` for large object counts without a default term.
Reported by: | dd32 | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
When deleting a term, the term has to be removed individually from each object it's connected to. When there exist a lot of objects, that can take some significant time.
The attached PR optimises wp_delete_term()
slightly to simply call wp_remove_object_terms()
when no default term is required, skipping the terms fetch/diff step which can significantly speed up the deletion process.
This was encountered on WordPress.org Support Forums while trying to remove a topic tag with 10,000+ threads, at that scale the fetch/diff process was much slower than simply removing the term.
Change History (4)
This ticket was mentioned in PR #1011 on WordPress/wordpress-develop by dd32.
4 years ago
#1
- Keywords has-patch added
#2
@
4 years ago
- Milestone changed from Awaiting Review to 5.7
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
hellofromtonya commented on PR #1011:
4 years ago
#4
Merged with changeset https://core.trac.wordpress.org/changeset/50389
When no default term exists for a taxonomy and we're deleting a term, skip fetch/diff/set, just remove the term directly from all objects.
Trac ticket: https://core.trac.wordpress.org/ticket/52549