Created
November 22, 2013 14:41
-
-
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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