The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress: Preload next post images Re: WordPress: Preload next post images


I figured it is a pretty tall ask – but there must be a way of gathering the Next post ID and it’s attached Featured image/images.

I did come across this which is kind of on the right lines:

function twpw_imagepreload() {
$imageloader= null;
$imageloader = new WP_Query();
if ($imageloader->have_posts()) : while ($imageloader->have_posts()) : $imageloader->the_post();
'post_parent' => $parentid,
'post_mime_type' => 'image'
$image_query = get_children($args1);
foreach ( $image_query as $attachment_id => $attachment ) {
endwhile; endif;
return $imagepreload;

It’s purpose is to load ALL attached images, but it times stops after loading the first 6 (i think), not sure why.

Any other suggestions as to how i could achieve this, or something similar?