the_post_thumbnail()WP 2.9.0

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.

1 time — 0.001739 sec (very slow) | 50000 times — 6.79 sec (fast) | PHP 7.1.2, WP 4.7.3

No Hooks.


null. Nothing.


the_post_thumbnail( $size, $attr );
Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order).
Default: 'post-thumbnail'
Query string or array of attributes.
Default: ''



Since 2.9.0 Introduced.

Code of the_post_thumbnail() WP 5.9.3

function the_post_thumbnail( $size = 'post-thumbnail', $attr = '' ) {
	echo get_the_post_thumbnail( null, $size, $attr );