How to tell WP to NOT generating different image sizes, except for featured img

Hello dear Sitepoint members.

As the name of topic implies, I want to prevent WP from generating different image sizes, except for the post featured image.

The problem is I don’t want to prevent generating different sizes for ALL images.

More details:
I want WP generate all sizes JUST for the first image in my
posts(because it’s feature image & all generated sizes will be use
on index), but NOT for other images.

For example there’s 4 image in my post. I want WP to generate image
sizes for the first image(which is my featured image, and for 3 other
images I don’t want different sizes.

How can I achieve this ?
I appreciate your help.

Is there a reason you don’t want them? Do you have extremely limited storage space on your host? If not, I’d suggest just ignoring them. As long as they aren’t all being loaded to the viewer, I can’t see the harm.

To answer the question:
I’ve read an article on this once. I know that you can stop some of them universally by going to settings → media and setting the sizes of those (Medium Image or whatever) to 0x0… but that’d be for all of them, not just all but the featured as you wish. And I’m pretty sure that some of the image sizes created were/can be theme controlled? I’d have to look it up to get you a better answer and can’t just at the moment.

Seems like it might be a complicated thing to do for little or no gain. There’s probably someone here who can tell you more though - also I bet this is a topic that could be fairly easily Google researched. :smile:

  1. what jeffreylees said. Not worth it.
  2. you post is not entirely clear.

For example there’s 4 image in my post

are you saying that additional images come up in your post and that is what you are trying to avoid?

Thanks Jeffreylees for reply.
Yes, I know they aren’t being loaded to the viewer. But as you said one problem is the limited storage space and the other problem is that with those useless images the backup file has more size, and I think takes more time.
BTW, they’re totally useless images.

And Yes, we can use settings->media , and then remove add_image_size() in theme’s Functions.php. but the real problem is that way it’s effect ALL images, and I don’t want that. I want all sizes generated for my first image on the post, and for the rest images ONLY the original size.

Any idea ?

Thanks pdx.
No, there are not unwanted images in my post.
Look, I upload 4 image for my new post. Regularly three or more sizes generated for each one of those 4 images. right?
The First image I uploaded will be select as Featured Image and I want all different generated sizes for this first image because all sizes for this first image will be used in my theme.
But for those other 3 images, I don’t want WP generates different sizes because they’re totally useless.
Is it clear Now ?

BTW, sorry for my bad English & thanks for your response guys.

It may be that you are only using the first image in another page where you want it to be down-sized.

But there might be other places you haven’t thought of where using a thumbnail would be preferred eg. RSS feed

Yes. really. If you are worried about sizes and memory. I don’t think it will be an issue and will most likely need various sizes later. Not really worth the time tinkering w/.
You also want to consider that your site might be viewed over various platforms. and you would want to use smaller sized images for that.
Responsiveness is pretty much a given for more & more sites now days.

1 Like

You can stop WordPress from generating default image sizes by visiting Settings » Media in WordPress admin area. There you will see default image sizes predefined by WordPress. You need to set these sizes to 0 which will prevent WordPress from generating default image sizes when you upload a new image.

That answer has already been given and discussed and isn’t an applicable solution to OP’s problem :wink:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.