Disable Missing Image Dimensions on Specific Images
If the Add Missing Image Dimensions feature causes a problem with any specific images, it's possible to exclude them with the following helper plugin.
📥 Download (.zip): WP Rocket | No Automatic Width/Height for Custom Image Sources
Developers: You can find the code for this plugin on GitHub.
📝 Manual code edit required before use!
- After downloading the plugin zip file, unzip it and open the PHP file in a text editor.
- Look for the following sample image paths in the code.
Replace these with the real image URLs you want to exclude:
$excluded_src = [ 'https://domain.ext/path/to/image.ext', 'https://domain.ext/path/to/image-2.ext', ];
- If you only need to exclude one image, you may remove the second line in the example.
If you need to exclude more images, you may keep adding as many lines as necessary.
- After making your edits, save the PHP file and re-zip the plugin.
- In your WordPress site, go to Plugins > Add New > Upload Plugin and upload the zip file.
- Activate it and then clear the WP Rocket cache.
Excluding images by extension
If by any reason you need to exclude all the images with specific extension(s), you can replace the lines with the extension(s), one per line.
For example, to exclude all SVG images from Add missing image dimensions, line 32 of the above helper plugin should look like this:
$excluded_src = [ '.svg', ];
You can replace
.svg with any extension, such as
Additionally, to exclude multiple extensions, you can duplicate and add more lines, as follows:
$excluded_src = [ '.svg', '.webp', ];