How do I set the medium and large images sizes in WP to hard crop?

In my theme I can set the thumbnail size to hard crop using this:

set_post_thumbnail_size( 96, 96, true );

But I can see no way to make the medium and large images to hard crop.

Is there possibly a way to remove the medium and large sizes and re-add them using:

add_image_size( 'medium', $width, $height, true );
add_image_size( 'large', $width, $height, true );

4 Answers 4


You can over write the default like this:

add_image_size( 'medium', 200, 200, true );
  • 3
    Yes it was this simple! I was so convinced it couldn't be that...
    – Scott
    Oct 13, 2011 at 10:47

Here's an improvement that uses the settings as you tried to do:

add_image_size('medium', get_option( 'medium_size_w' ), get_option( 'medium_size_h' ), true );

  • 4
    the benefit from this solution is, that you still can set the measurements in the wp setting. sweet.
    – honk31
    Apr 8, 2016 at 16:40
  • This is perfect! Mar 21, 2019 at 15:24

To enable cropping for the medium images, it is enough to use this code:

update_option( 'medium_crop', 1 );

The update_option() function itself checks whether such an option exists, and adds it if necessary:

If the option does not exist, then the option will be added with the option value, with an $autoload value of yes.


The Gleb's answer worked nicely for me.

// Medium Size Thumbnail
if(false === get_option('medium_crop')) {
    add_option('medium_crop', '1'); 
} else {
    update_option('medium_crop', '1');

Found the full code here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.