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!

  1. After downloading the plugin zip file, unzip it and open the PHP file in a text editor.
  2. Look for the following sample image paths in the code.

    Replace these with the real image URLs you want to exclude:

    	$excluded_src = [
  3. 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.
  4. After making your edits, save the PHP file and re-zip the plugin. 
  5. In your WordPress site, go to Plugins > Add New > Upload Plugin and upload the zip file. 
  6. 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 = [

You can replace .svg with any extension, such as .webp, .jpg, etc. 

Additionally, to exclude multiple extensions, you can duplicate and add more lines, as follows:

$excluded_src = [
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.