Skip to content

Instantly share code, notes, and snippets.

@sethrubenstein
Created November 22, 2013 14:41
Show Gist options
  • Save sethrubenstein/7600907 to your computer and use it in GitHub Desktop.
Save sethrubenstein/7600907 to your computer and use it in GitHub Desktop.
If you've ever run into the issue where going into the media library > editing an image > and the image that might be used in a custom field isn't updated on the post this will fix that.
/**
* This will update image sizes on save
*/
function add_image_options($data){
global $_wp_additional_image_sizes;
foreach($_wp_additional_image_sizes as $size => $properties){
update_option($size."_size_w", $properties['width']);
update_option($size."_size_h", $properties['height']);
update_option($size."_crop", $properties['crop']);
}
return $data;
}
add_action('image_editor_save_pre', 'add_image_options');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment