Images all broken after migration and upgrade

I have upgraded a neglected WordPress installation the was a few versions off.

After the installation and upgrading multiple version, all of my images are now broken which were not before. Whenever I trace the filename back to the directory it should be in I see the same thing – the image is in existance, however WordPress has appended a dimension x dimension to each of the references inside of WordPress.

See what I mean:

Image file name being manipulated by WordPress

Images broken in view

Directory listing, showing that the image is in existence

I have tried all solutions offered for similar WP issues however none have solved the problem.

After following this thread https://wordpress.org/support/topic/after-upgrade-to-44-media-files-are-not-showing I recieved a server 500 error.

Adding this conditional showed me the add_filter does not available inside functions.php

if (function_exists('add_filter')){
        add_filter('wp_get_attachment_image_attributes', function($attr) {
        if (isset($attr['sizes'])) unset($attr['sizes']);
        if (isset($attr['srcset'])) unset($attr['srcset']);
        return $attr;
    }, PHP_INT_MAX);

    add_filter('wp_calculate_image_sizes', '__return_false', PHP_INT_MAX);

    add_filter('wp_calculate_image_srcset', '__return_false', PHP_INT_MAX);

    remove_filter('the_content', 'wp_make_content_images_responsive');

} else echo 'No function exists for this method!';

Could someone please help me get WordPress to stop referencing my images by the incorrect filename? Any help on this would be fantastic. Also when does WordPress come up with these dimensions… are they specific to the viewport size or are these theme specific?

Please also note I have turned off all plugins and reverted to the default WordPress theme as advised on the WP support site.

Thanks SO!

Update:
Since none of the suggestions so far worked I will go back to an older version before responsive images feature is introduced and I will migrate again. I will let everyone know my progress. I am inclined to think that this is caused by removing the images during the installation (they were being scanned to make sure there was no virus/malware hidden in the images from the old infected box)

1
1

I think a quick thumbnail regeneration might be the cure for this. Try using Regenerate Thumbnails or a similar plugin, but backup your uploads directory before proceeding.

In order to just disable WP responsive images use this filter.

/**
 * Disable WP 4.4 srcset
 */
add_filter( 'wp_calculate_image_srcset', '__return_empty_array' );

Leave a Comment