Created
July 27, 2023 12:11
-
-
Save jamieschmid/af321397f7966f791aab92637729cace to your computer and use it in GitHub Desktop.
WordPress soft crop function using intermediate_image_sizes_advanced()
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
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