Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jamieschmid/af321397f7966f791aab92637729cace to your computer and use it in GitHub Desktop.
Save jamieschmid/af321397f7966f791aab92637729cace to your computer and use it in GitHub Desktop.
WordPress soft crop function using intermediate_image_sizes_advanced()
function soft_crop( $sizes ) {
$sizes['medium'] = array(
'width' => 300,
'height' => 0,
'crop' => true,
);
return $sizes;
}
add_filter( 'intermediate_image_sizes_advanced', 'soft_crop' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment