Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom image size at 200x150 that works fine in a plugin I'm working on. Uploading new files is no problem but when I edit an image, the default image sizes get regenerated but my custom size does not. Is there a way to force the regeneration programatically in a filter or something?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

To regenerate custom image size when image is edited in image editor , You have to add following options in wp_options table using update_option function along with add_image_size.

Example :

$img_size_name = 'custom-size'; // The new image size name.
if ( function_exists( 'add_theme_support' ) )
add_image_size($img_size_name, 100, 100 , true);

update_option($img_size_name.'_size_w', 100);
update_option($img_size_name.'_size_h', 100);
update_option($img_size_name.'_crop', 1);
share|improve this answer
1  
Thank you, that did it. It's weird that add_image_size doesn't do this by default. Sounds like the function needs to be expanded. –  Manny Fleurmond Mar 8 '13 at 14:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.