#26768 closed enhancement (fixed)
Add remove_image_size()
Reported by: | Daedalon | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | normal | Version: | 3.8 |
Component: | Media | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
There have been numerous requests for a remove_image_size() function in WordPress. add_image_size() needs such a counterpart to let child themes fully define what media they support and to avoid creating unnecessary resized images.
For example the Elbee Elgee theme defines a 640px * 9999px image size. Our child theme doesn't use this size anywhere. However, as long as that image size if defined, an image of that size will be generated for each larger image that is uploaded.
Without remove_image_size() it's not possible to avoid generating those unnecessary images in an update-safe way.
Attachments (2)
Change History (14)
#3
@
11 years ago
Thanks, Marko! Tested in 3.8. Works like a charm. It's now possible to remove and/or redefine image sizes upon init:
function my_custom_image_sizes( ) { remove_image_size( 'theme-image-size' ); // Removing default size add_image_size( 'theme-image-size', 400, 300 ); // Re-adding with a custom size } add_action( 'init', 'my_custom_image_sizes' );
#8
in reply to:
↑ 7
@
11 years ago
Replying to markoheijnen:
Curious if we also should add has_image_size() then ;)
I've wanted to have that a few times. I'll write up a quick patch and new ticket.
It makes totally sense to have something like this. Added a patch. Not sure if there should be a message when it's called to late.