Doubled thumbnails in uploads (2 posts)

  1. cricalix
    Posted 9 years ago #

    Somewhere in the 2.x series of WordPress, my file uploads started doubling up - I see double thumbnails for every image I upload (see http://www.cricalix.net/~dhill/wordpress-double-thumbs.jpg The hyperlinks for each thumbnail are identical.

    This, as you might imagine, is irritating. I don't believe I have any plug-ins installed that should be doing this.

    Bug? Misconfiguration?

  2. cricalix
    Posted 9 years ago #

    This looks, to me, to be a problem down in upload-functions.php, in the wp_upload_tab_browse() function. It appears to get double attachment entries for any given post.

    Tracing the SQL executed:
    SELECT SQL_CALC_FOUND_ROWS posts.* FROM posts LEFT JOIN postmeta ON posts.ID = postmeta.post_id WHERE 1=1 AND (post_type = 'attachment') ORDER BY post_date DESC LIMIT 30, 10

    returns double entries for each post, and thus generates a doubled count for the next query that gets executed (the found_rows() query).

    If I mod the loop in that function, so that it keeps track of the last ID it saw:

    if ( have_posts() ) : while ( have_posts() ) : the_post();
    if (get_the_ID() == $last_id) { continue; }
    $last_id = get_the_ID();

    the output to the browser is what I expect. However, I can't believe that WordPress is this borked, so it's got to be something in my setup.

Topic Closed

This topic has been closed to new replies.

About this Topic