[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 Mar 21 18:24:22 UTC 2023


#57966: High number of call to sanitize_term in
wp_queue_posts_for_term_meta_lazyload
--------------------------+--------------------
 Reporter:  spacedmonkey  |      Owner:  (none)
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  6.3
Component:  Taxonomy      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:  performance   |
--------------------------+--------------------
 In [55252] was refactored wp_queue_posts_for_term_meta_lazyload to use
 `wp_cache_get_multiple`. This refactor includes a call to `get_term`.
 However calling `get_term` calls `sanitize_term`, which sanitizes term all
 fields in a term. This can mean, if there are say 40 terms called to this
 function, it can mean that `sanitize_term` and then `sanitize_term_field`
 is called. As there 9 fields to sanitize, this can mount up quickly.

 This is no need to use `get_term` here, a object with the shape of a term
 will work as well and will not run through all these `sanitize_term_field`
 calls.

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


More information about the wp-trac mailing list