#52549 closed defect (bug) (fixed)
Optimize `wp_delete_term()` for large object counts without a default term.
| Reported by: | dd32 | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.7 |
| Component: | Taxonomy | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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.
5 years ago
#1
- Keywords has-patch added
hellofromtonya commented on PR #1011:
5 years ago
#4
Merged with changeset https://core.trac.wordpress.org/changeset/50389
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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