[wp-trac] [WordPress Trac] #57966: High number of call to sanitize_term in wp_queue_posts_for_term_meta_lazyload

WordPress Trac noreply at wordpress.org
Tue May 2 10:56:13 UTC 2023


#57966: High number of call to sanitize_term in
wp_queue_posts_for_term_meta_lazyload
--------------------------+---------------------------
 Reporter:  spacedmonkey  |       Owner:  spacedmonkey
     Type:  enhancement   |      Status:  closed
 Priority:  normal        |   Milestone:  6.3
Component:  Taxonomy      |     Version:  6.2
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+---------------------------
Changes (by spacedmonkey):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"55701" 55701]:
 {{{
 #!CommitTicketReference repository="" revision="55701"
 Taxonomy: Remove redundant call to `get_term` in
 `wp_queue_posts_for_term_meta_lazyload`.

 In [55252] the function `wp_queue_posts_for_term_meta_lazyload` was
 refactored to use `wp_cache_get_multiple`. This refactor included a call
 to `get_term`. However, calling get_term calls `sanitize_term`, which
 sanitizes all fields in a term. The full term object is not needed in this
 context as term meta only needs to the term id, which is already in the
 function. Saving calls to `sanitize_term` will improve performance of this
 function.

 Props spacedmonkey, joemcgill, mukesh27.
 Fixes #57966.
 }}}

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


More information about the wp-trac mailing list