[wp-trac] [WordPress Trac] #40490: Prime post cache in `wp_make_content_images_responsive()`
WordPress Trac
noreply at wordpress.org
Fri Aug 25 15:36:01 UTC 2017
#40490: Prime post cache in `wp_make_content_images_responsive()`
-------------------------+------------------------
Reporter: dlh | Owner: joemcgill
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 4.9
Component: Media | Version: 4.7
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+------------------------
Comment (by joemcgill):
This is a great catch, @dlh.
Originally, when we implemented `wp_make_content_images_responsive()` we
intentionally decided to only query the post meta using `get_post_meta()`
as to avoid the extra Post queries, which is why `update_meta_cache()` was
used in [35412]. However, it makes sense that someone filtering the values
of `wp_get_attachment_metadata()` would want consistency here as well, so
switching back to `_prime_post_caches()` is better here and avoids a bunch
on unnecessary queries.
We may also want to consider ways we can avoid the `get_post()` check
inside of `wp_get_attachment_metadata()` since those queries are often
unnecessary when only metadata is needed.
In the mean time, this patch is a good improvement.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40490#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list