WordPress at a glance

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.

Works based on: get_the_post_thumbnail()
1 time = 0.001739s = very slow | 50000 times = 6.79s = 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: ''


  • See: get_the_post_thumbnail()


Since 2.9.0 Introduced.

Code of the_post_thumbnail() WP 5.6

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

From tag: Thumbnail (images)

More from category: Thumbnails

More from Template Tags: Post Thumbnails

No comments
    Log In