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

WordPress Trac noreply at wordpress.org
Wed Jul 23 22:43:11 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
-----------------------------------+------------------------------

Comment (by xipasduarte):

 Hello @oglekler. Thanks for the feedback. I thought about raising an issue
 for the `get_row()` method, but there is good reason for it to be like
 this. You are right that it only returns a single result, but it does not
 limit what is requested from the database, as that is the responsibility
 of the query itself.

 My thoughts were that queries can vary a lot and, in some cases, it might
 be very bad to mess around with what is passed as it could lead to
 breaking the query itself. The method `get_row()` is used as part of
 WordPress' API and we would need to be very careful when "messing" with
 it.

 That being said, there is an issue for potential improvement as a hole, by
 looking into `get_row()`. But due to the time it would take, the current
 change would be of benefit right away and would not lead to any
 duplication. If we consider that the case where queries containing `LIMIT`
 need to be address in rewriting `get_row()` this would fall under that.

 I'll gladly open an issue in regards to `get_row()` once I've got the time
 to review the best approach and offer some insights.

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


More information about the wp-trac mailing list