Skip to content

Commit

Permalink
Use correct cache warming function
Browse files Browse the repository at this point in the history
makes use of update_postmeta_cache

resolves ResponsiveImagesCGgh-197
  • Loading branch information
peterwilsoncc committed Oct 2, 2015
1 parent f2dc120 commit 69ad5dd
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions wp-tevko-responsive-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,10 @@ function tevkori_filter_content_images( $content ) {
/**
* Warm object caches for use with wp_get_attachment_metadata.
*
* To avoid making a database call for each image, WP_Query is called
* as a single query with the IDs of all images in the post. This warms
* the object cache with the meta information for all images.
*
* This loop is not used directly.
* To avoid making a database call for each image, a single query
* warms the object cache with the meta information for all images.
**/
$attachments = new WP_Query(array(
'post_type' => 'attachment',
'posts_per_page' => '-1',
'post_status' => 'inherit',
'post__in' => $ids,
));
update_postmeta_cache( $ids );
}

foreach( $matches[0] as $k => $image ) {
Expand Down

0 comments on commit 69ad5dd

Please sign in to comment.