Default Post Thumbnails in WordPress

Hey there! I'm currently working on a CLI tool to deploy WordPress apps to DigitalOcean. Check it out! It's free and open source.

Justin Tadlock wrote about the right ways to add default post thumbnails to your WordPress themes. One method is to filter on post_thumbnail_html, and the second method is to simply use else with has_post_thumbnail.

The second method is easier to understand, straightforward and future-proof. The filter in the first method would only work well when we need to change the markup of the thumbnail images output, like print a div with a background-image instead of an img element.

About the author

Konstantin Kovshenin

WordPress Core Contributor, ex-Automattician, public speaker and consultant, enjoying life in Moscow. I blog about tech, WordPress and DevOps.