[wp-trac] [WordPress Trac] #49446: cache the results of get_uploaded_header_images()

WordPress Trac noreply at wordpress.org
Sun Feb 16 04:02:33 UTC 2020


#49446: cache the results of get_uploaded_header_images()
-------------------------+------------------------------------------
 Reporter:  pbiron       |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Cache API    |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  administration, performance
-------------------------+------------------------------------------

Comment (by SergeyBiryukov):

 Replying to [ticket:49446 pbiron]:
 > If the current theme supports `custom-header` and
 `is_random_header_image()` is true, then `_media_states()` calls
 `get_uploaded_header_images()` for **every** row in the media list table.

 Even with caching added, saving `$header_images` to a static variable in
 `_media_states()` seems like a quick win to avoid having to go through
 `wp_list_pluck()` for the result of `get_uploaded_header_images()` for
 every row.

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


More information about the wp-trac mailing list