Auto crop images in WordPress June 4, 2022 by Tarik Billa You can use add_image_size to create your custom size like this: add_image_size( 'featured-works', 220, 180, true ); then get it like this: wp_get_attachment_image_src($thumbnail_id,'featured-works'); take into account how the crop works here