How to prevent WordPress from creating thumbnails

WordPress has this great feature to create thumbnails for every media (image) you upload.

This is great as long as you use those thumbnails in your theme. However if you don't those extra images will start using up your space. Imagine 3000 uploads with its own set of thumbnails (x3)... well, you do the math.

Some blog posts will recommend you to set the size of the thumbnails (from Settings > Media) to 0. At the time of the writing (WordPress 3.9) the size 0 trick doesn't work.

You can turn the thumbnails off by pasting this snippet in your theme's functions.php file.

Overriding custom size thumbnails

If you're using a Child Theme (and you should) you might want to also remove custom sizes set from the parent theme.

Here's an example to remove TwentyTwelve custom thumbnail size:

As you can see we've done two things here.

  1. Delay the filter by passing 11 as a parameter.
  2. Unsetting the custom size.

Leave a Reply

Add <code> Some Code </code> by using this tags.