[wp-trac] [WordPress Trac] #59354: Unnecessary queries performed when updating a post without providing categories or tags

WordPress Trac noreply at wordpress.org
Thu Jun 13 11:47:45 UTC 2024


#59354: Unnecessary queries performed when updating a post without providing
categories or tags
--------------------------------------+------------------------------
 Reporter:  johnbillion               |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Posts, Post Types         |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+------------------------------

Comment (by LeonidasMilossis):

 >If `$postarr` doesn't contain a `tags_input` element, there's no point in
 calling `wp_set_post_tags()`.

 We already do that in `wp_insert_post()` and indeed there's no extra
 queries unless we add `'tags_input' => $tag_id,` in the `wp_insert_post()`
 params.

 So, that part can probably be removed from the scope of this ticket.

 The submitted PR adds a unit test that attests to that.

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


More information about the wp-trac mailing list