the_post_thumbnail()
Display the post thumbnail.
When a theme adds 'post-thumbnail' support, a special 'post-thumbnail' image size is registered, which differs from the 'thumbnail' image size managed via the Settings > Media screen.
When using the_post_thumbnail() or related functions, the 'post-thumbnail' image size is used by default, though a different size can be specified instead as needed.
Uses: get_the_post_thumbnail()
1 time — 0.001739 sec (very slow) | 50000 times — 6.79 sec (fast) | PHP 7.1.2, WP 4.7.3
No Hooks.
Return
null
. Nothing.
Usage
the_post_thumbnail( $size, $attr );
- $size(string|int[])
- Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order).
Default: 'post-thumbnail' - $attr(string|array)
- Query string or array of attributes.
Default: ''
Notes
Changelog
Since 2.9.0 | Introduced. |
Code of the_post_thumbnail() the post thumbnail WP 5.9.3
function the_post_thumbnail( $size = 'post-thumbnail', $attr = '' ) { echo get_the_post_thumbnail( null, $size, $attr ); }