[wp-trac] [WordPress Trac] #63683: Improve wp_insert_term() duplicate query

WordPress Trac noreply at wordpress.org
Wed Jul 23 17:08:28 UTC 2025


#63683: Improve wp_insert_term() duplicate query
-----------------------------------+------------------------------
 Reporter:  xipasduarte            |       Owner:  (none)
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Awaiting Review
Component:  Taxonomy               |     Version:
 Severity:  minor                  |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:  performance
-----------------------------------+------------------------------
Changes (by oglekler):

 * keywords:  has-patch => has-patch 2nd-opinion


Comment:

 Hi @xipasduarte,
 Thank you for the ticket!


 {{{$wpdb->get_row()}}} returns only one row, so there is no need to add
 LIMIT 1. It should be no long request. We need reproduction report with
 actual numbers and DB queries that were made. And if
 {{{$wpdb->get_row()}}} actually makes a query in such a way that request
 to DB is getting more than 1 row and slows down due to amount of matching
 rows, then we should raise a question about fixing the {{{get_row()}}}
 method instead of adding LIMIT 1 here and there.

 So, I am adding 2nd-opinion that indicated that we need some evaluation
 from a developer.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63683#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list