Core Function
View Source on Trac ↗ get_the_post_thumbnail()
get_the_post_thumbnail( mixed $post = null, mixed $size = 'post-thumbnail', mixed $attr = '' ) Retrieves the post thumbnail.
Parameters 3 required
| Name / Type | Description |
|---|---|
| (int | | WP_Post | null) $post Optional. Post ID or WP_Post object. Default is global `$post`. Required |
| mixed | (string | int[]) $size Optional. Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default 'post-thumbnail'. Required |
| (string | | array) $attr Optional. Query string or array of attributes. Default empty. Required |
Return Value
(string)
The post thumbnail image tag.
Function Information
Since Version
2.9.0
Source File
wp-includes/post-thumbnail-template.php
Advertisement