Media: Prime post caches in 'wp_make_content_images_responsive()'.
In [38296] we replaced `get_post_meta()` with `wp_get_attachment_metadata()` so that attachment metadata could be consistently filtered. However, this results in extra post queries which were previously avoided. This uses `_prime_post_caches()` instead of `update_meta_cache()` to improve post caching before looping through all images to retrieve attachment metadata. Props dlh. Fixes #40490. Built from https://develop.svn.wordpress.org/trunk@41315 git-svn-id: http://core.svn.wordpress.org/trunk@41146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
10177e7fbb
commit
bbb8d48086
|
@ -1335,12 +1335,10 @@ function wp_make_content_images_responsive( $content ) {
|
|||
|
||||
if ( count( $attachment_ids ) > 1 ) {
|
||||
/*
|
||||
* Warm object cache for use with 'get_post_meta()'.
|
||||
*
|
||||
* To avoid making a database call for each image, a single query
|
||||
* warms the object cache with the meta information for all images.
|
||||
* Warm the object cache with post and meta information for all found
|
||||
* images to avoid making individual database calls.
|
||||
*/
|
||||
update_meta_cache( 'post', array_keys( $attachment_ids ) );
|
||||
_prime_post_caches( array_keys( $attachment_ids ), false, true );
|
||||
}
|
||||
|
||||
foreach ( $selected_images as $image => $attachment_id ) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9-alpha-41314';
|
||||
$wp_version = '4.9-alpha-41315';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue