Title: set_post_thumbnail_size
Published: April 25, 2014
Last modified: May 20, 2026

---

# set_post_thumbnail_size( int $width, int $height, bool|array $crop = false )

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#parameters)
 * [More Information](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#wp--skip-link--target)

Registers an image size for the post thumbnail.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#see-also)󠁿

 * [add_image_size()](https://developer.wordpress.org/reference/functions/add_image_size/):
   for details on cropping behavior.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#parameters)󠁿

 `$width`intrequired

Image width in pixels.

`$height`intrequired

Image height in pixels.

`$crop`bool|arrayoptional

Image cropping behavior. If false, the image will be scaled (default).
 If true,
image will be cropped to the specified dimensions using center positions. If an 
array, the image will be cropped using the array to specify the crop location:

 * `0` string
 * The x crop position. Accepts `'left'`, `'center'`, or `'right'`.
 * `1` string
 * The y crop position. Accepts `'top'`, `'center'`, or `'bottom'`.

Default:`false`

## 󠀁[More Information](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#more-information)󠁿

 * To register additional image sizes for Featured Images use: [add_image_size()](https://developer.wordpress.org/reference/functions/add_image_size/).
 * To enable featured images, the current theme must include `add_theme_support('
   post-thumbnails' );` in its [functions.php](https://developer.wordpress.org/themes/basics/theme-functions/)
   file. See also [Post Thumbnails](https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/).
 * This function will not resize your existing featured images. To regenerate existing
   images in the new size, use the [Regenerate Thumbnails](https://wordpress.org/plugins/regenerate-thumbnails/)
   plugin.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#source)󠁿

    ```php
    function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) {
    	add_image_size( 'post-thumbnail', $width, $height, $crop );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/media.php#L362)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/media.php#L362-L364)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#related)󠁿

| Uses | Description | 
| [add_image_size()](https://developer.wordpress.org/reference/functions/add_image_size/)`wp-includes/media.php` |

Registers a new image size.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 4 content](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#comment-content-471)
 2.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/#comment-471)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fset_post_thumbnail_size%2F%23comment-471)
     Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fset_post_thumbnail_size%2F%23comment-471)
 4.  **Default Usage**
      To be used in the current theme’s `functions.php` file.
 5.      ```php
         function wpdocs_setup_theme() {
         	add_theme_support( 'post-thumbnails' );
         	set_post_thumbnail_size( 150, 150 );
         }
         add_action( 'after_setup_theme', 'wpdocs_setup_theme' );
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fset_post_thumbnail_size%2F%3Freplytocom%3D471%23feedback-editor-471)
 7.   [Skip to note 5 content](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#comment-content-472)
 8.    [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/#comment-472)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fset_post_thumbnail_size%2F%23comment-472)
     Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fset_post_thumbnail_size%2F%23comment-472)
 10. **Crop Mode**
      Set the default Post Thumbnail size by resizing the image proportionally(
     that is, without distorting it):
 11.     ```php
         set_post_thumbnail_size( 50, 50 ); // 50 pixels wide by 50 pixels tall, resize mode
         ```
     
 12. Set the default Post Thumbnail size by cropping the image (either from the sides,
     or from the top and bottom):
 13.     ```php
         set_post_thumbnail_size( 50, 50, true ); // 50 pixels wide by 50 pixels tall, crop mode
         ```
     
 14. Set the default Post Thumbnail size by cropping the image from top left:
 15.     ```php
         set_post_thumbnail_size( 50, 50, array( 'top', 'left')  ); // 50 pixels wide by 50 pixels tall, crop from the top left corner
         ```
     
 16. Set the default Post Thumbnail size by cropping the image from the center:
 17.     ```php
         set_post_thumbnail_size( 50, 50, array( 'center', 'center')  ); // 50 pixels wide by 50 pixels tall, crop from the center
         ```
     
 18. _Note:_
      This function will not resize your existing featured images. To regenerate
     existing images in the new size, use the Regenerate Thumbnails plugin.
 19.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fset_post_thumbnail_size%2F%3Freplytocom%3D472%23feedback-editor-472)
 20.  [Skip to note 6 content](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/?output_format=md#comment-content-6521)
 21.   [Gabor Lippert](https://profiles.wordpress.org/lunule/)  [  3 years ago  ](https://developer.wordpress.org/reference/functions/set_post_thumbnail_size/#comment-6521)
 22. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fset_post_thumbnail_size%2F%23comment-6521)
     Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fset_post_thumbnail_size%2F%23comment-6521)
 23. I guess this just stopped working in the new Gutenberg editor environment. ¯\_(
     ツ)_/¯
 24. At least with the below, totally standard usage, the function doesn’t have any
     effect on the way a post thumbnail gets displayed on a post edit screen.
 25.     ```php
         function wpdocs_mac_setup_theme() {
         	add_theme_support( 'post-thumbnails' );
         	set_post_thumbnail_size( 280, 153, false );
         }
         add_action( 'after_setup_theme', 'wpdocs_mac_setup_theme' );
         ```
     
 26.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fset_post_thumbnail_size%2F%3Freplytocom%3D6521%23feedback-editor-6521)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fset_post_thumbnail_size%2F)
before being able to contribute a note or feedback.