I mean:

add_action( 'after_setup_theme', 'thumbs_setup' );
function thumbs_setup() {
  add_theme_support( 'post-thumbnails' );

My media settings are 150x150px on thumbnails, but now the_post_thumbnail() will output a full sized image instead. Why?

I see that the only way to have the_post_thumbnail() to really output the thumbnail size is to explicitly pass it:



2 Answers 2


the_post_thumbnail is unfortunately named, because it suggests a small image but actually refers to the featured image of a post. Adding support for it simply makes the 'featured image' box available in your post editor.

Now, if you look at the source code, you see that if there is no size specified when calling the_post_thumbnail, the size is defined as post-thumbnail. However, this is not the name of the default thumbnail generated for every image, which is thumbnail. There is no image size called 'post-thumbnail' generated by default. As a result, WP will use the full image.

There are several ways to get around this, but the easiest would be to use a filter available in get_the_post_thumbnail, the function that is used by the_post_thumbnail. You can reroute the default call from 'post-thumbnail' to 'tumbnail' like this:

add_filter ('post_thumbnail_size','wpse275569_post_thumbnail_size');
function wpse275569_post_thumbnail_size ($size) {
  if ($size == 'post-thumbnail') $size = 'thumbnail';
  return $size;

I think adding support to 'post-thumbnails' also adds a new type of size: 'post-thumbnail'. But 'post-thumbnail' is not == 'thumb' or 'thumbnail', it's a new, different type. Also, the_post_thumbnail() if called without params will output the 'post-thumbnail' size instead of the 'thumb' size.

'thumb' (or 'thumbnail') are setted via admin media panel, while 'post-thumbnail' is not.

Since the 'post-thumbnail' size is not yet setted, than the_post_thumbnail() doesn't really know what size to use, and thus it will output the full image.

To set the 'post-thumbnail' size you must use standard add-image-size() passing 'post-thumbnail' as the name, or, just use set_post_thumbnail_size().

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.