WordPress at Your Fingertips

the_post_thumbnail() WP 1.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.

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() WP 5.8.1

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

Thumbnail (images)

Thumbnails

Post Thumbnails

No comments
    Log In