Twenty Seventeen: Featured image not displayed on single template
|Reported by:||westonruter||Owned by:||davidakennedy|
I assigned a featured image to a post and it appeared as expected in the loop. When I navigated to a given post that had the featured image, however, it was nowhere to be seen. In looking further, the call to display the featured image is in header.php before the_post() is called and thus the $post global is not set. This means that has_post_thumbnail() return false and no featured image will be set. To reliably get the featured image, we need to explicitly pass in get_queried_object_id().
Change History (9)
3 months ago
- Keywords has-patch added
- Owner set to davidakennedy
- Status changed from new to assigned