How to get the thumbnail from a WP_Post object?

Posted by Editorial Staff | Updated on

Want to get the thumbnail from a WP_Post object? The following is just a proof of concept in form of shortcode. It dumps a code block with all posts that have a Featured Image.

Function reference: has_post_thumbnail(), get_the_post_thumbnail()

’;
return $echo;
}

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers