Skip to content

Instantly share code, notes, and snippets.

@mcgregormedia
Created March 25, 2015 12:36
Show Gist options
  • Save mcgregormedia/8f6175c463a88b987268 to your computer and use it in GitHub Desktop.
Save mcgregormedia/8f6175c463a88b987268 to your computer and use it in GitHub Desktop.
add_filter( 'wp_generate_attachment_metadata', 'retina_support_attachment_meta', 10, 2 );
function retina_support_attachment_meta( $metadata, $attachment_id ) {
foreach ( $metadata as $key => $value ) {
if ( is_array( $value ) ) {
foreach ( $value as $image => $attr ) {
if ( is_array( $attr ) )
retina_support_create_images( get_attached_file( $attachment_id ), $attr['width'], $attr['height'], true );
}
}
}
return $metadata;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment