[wp-trac] [WordPress Trac] #52549: Optimize `wp_delete_term()` for large object counts without a default term.

WordPress Trac noreply at wordpress.org
Wed Feb 17 02:56:29 UTC 2021


#52549: Optimize `wp_delete_term()` for large object counts without a default term.
--------------------------+-----------------------------
 Reporter:  dd32          |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52549>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list