I have added the following code in my functions.php

add_theme_support( 'post-thumbnails' );  
set_post_thumbnail_size( 150, 150);

My posts display with a thumbnail with the 150x150 dimensions. However, I'd like to change the size. When I change the 150 by 150 in the set_post_thumbnail_size to 200 or any other number, it doesn't actually change the size of my thumbnails. I tried going into media settings and change the size there. In the media settings I can shrink the size, but if I try to change it to 200 or 300 it doesn't actually have any impact.

Any idea how I can modify it?


2 Answers 2


The code you are using is correct. The problem is that you are looking at thumbnails that have already been created. As @Loius mentioned you will need to use Regenerate Thumbnails to see the effect. Why core has not implemented this is beyond me.

  • Because it's a non-trivial operation, core has no way of knowing if the thumbnail size has changed, and would have to check each image individually to test if they need regenerating. That's not really an issue when you have a plugin you can tell to start bulk processing thumbnails
    – Tom J Nowell
    Commented Sep 5, 2019 at 10:17
  • I have to say that most devs download it, it’s practically a requirement for the featured image “feature”. In fact it could work in tandem with the other custom image “features” (custom header etc.) if there were concern. I’m thinking of so many reasons it makes sense to include it. Commented Sep 14, 2019 at 2:00

Define your own image sizes

If you need your post thumbnail 50px by 50px without cropping the image as well without distorting it. Here is the solution. These all definitions should define in functions.php file.

set_post_thumbnail_size( 50, 50 ); // 50 pixels wide by 50 pixels tall, resize mode

As well as you can crop the image as you want. Here is an example for cropping.

set_post_thumbnail_size( 50, 50, array( 'top', 'left') ); // 50 pixels wide by 50 pixels tall, crop from the top left corner

In the array have pass the where to crop. This will crop the image starting from top left corner. If you need to crop the image from the center, just pass array( 'center', 'center' ) . This will crop the image from the center.

Not only these. You can define your own thumbnail name and define the sizes. Assume I need to create a thumbnail image for books category. Therefore I need an image 200px width and height should be auto . Lets see how to do this.

add_image_size( 'books', 200, 9999 ); //200 pixels wide (and unlimited height)

This will resize the book category image to 200px width and auto height.

You can call this image

<?php the_post_thumbnail( 'books' ); ?>

In a proper way you can call this image,

if(has_post_thumbnail( 'books' )) {
the_post_thumbnail( 'books' );

This will load the image where you define the code and it will be 200px wide and height is relative to the width.

Assume you’re wanting to add this Featured Images for books and all posts except other all custom post types. How to do this. See the code below. It’ll enable the Featured Image for all the posts and custom post type called books only.

add_theme_support( 'post-thumbnails', array( 'post', 'books' ) );

Source from nerodev

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.