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

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #32101

    As the title says, i would like a nice bit of coding to stick in my functions that pre-loads any images that are attached to the next post.

    This means that whilst my users are browsing, they page will load, but it will actually be loading the next page, so when you click-through, the images should already be there and waiting!

    Think of it as ‘buffering’ for image.

    Anyone got any thoughts on this?



    Hmmmmm – if it’s literally loading a new page, I’m not sure that can be done as the script that you’re using won’t know what the “next” page is.

    Certainly possible with AJAX if you made all pages load at once and then the user just cycles through them, but that has bookmarking issues that would preferably be avoided.

    Not sure if you can do this. Maybe somebody has some Javascript inspiration that I don’t.


    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?

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.