On this page
set_post_thumbnail_size( int $width, int $height, bool|array $crop = false )
Registers an image size for the post thumbnail.
Description
See also
- add_image_size() : for details on cropping behavior.
Parameters
$widthint Required-
Image width in pixels.
$heightint Required-
Image height in pixels.
$cropbool|array Optional-
Whether to crop images to specified width and height or resize.
An array can specify positioning of the crop area.Default:
false
More Information
- To register additional image sizes for Featured Images use: add_image_size() .
- To enable featured images, the current theme must include
add_theme_support( 'post-thumbnails' );in its functions.php file. See also Post Thumbnails. - This function will not resize your existing featured images. To regenerate existing images in the new size, use the Regenerate Thumbnails plugin.
Source
File: wp-includes/media.php. View all references
function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) {
add_image_size( 'post-thumbnail', $width, $height, $crop );
}
Related
Uses
| Uses | Description |
|---|---|
| add_image_size() wp-includes/media.php | Registers a new image size. |
Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/set_post_thumbnail_size