[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
Fri Mar 31 16:08:55 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:  assigned
 Priority:  normal        |   Milestone:  6.3
Component:  Taxonomy      |     Version:  6.2
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  performance
--------------------------+---------------------------

Comment (by joemcgill):

 At minimum, it looks like the first approach makes sense to me. We're only
 calling `get_term` to make sure an error isn't thrown before adding the
 term ID to the queue. One interesting behavior of get_term is that if it
 is past an object instead of an ID, it will apply raw filtering, which may
 already be more performant in scenarios like this than passing an ID which
 requires a new `WP_Term` instance to be generated and sanitized.

 Since we're not making use of any of those fields, but instead are only
 worried about adding the IDs to the queue, I think ignoring sanitation
 here is totally fine, and is in line with how this was functioning prior
 to the changes made in [55252].

 I'm not sure I fully grasp why the additional taxonomy checks were added
 in the prior commit. Could you provide more context, and why you think it
 would be fine to remove them in the second approach you're suggesting?

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


More information about the wp-trac mailing list