WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently using the_post_thumbnail(); to display featured images in my pages.

Is it possible to set a fallback placeholder image in the event a featured image hasn't been set?

share|improve this question
up vote 3 down vote accepted

You can use has_post_thumbnail() as condition and change output accordingly.

Example from Codex:

if(has_post_thumbnail()) {
} else {
    echo '<img src="'.get_bloginfo("template_url").'/images/img-default.png" />';
share|improve this answer
Is it possible to implement this in the functions so it would work for all instances of the the_post_thumbnail across the site? – Vince Pettit Mar 2 '12 at 11:35
@Vince Pettit from quick look that should be doable by making use of post_thumbnail_html filter. – Rarst Mar 2 '12 at 12:44
There is a plugin that does this: wordpress.org/plugins/default-featured-image – raison Jun 12 '15 at 10:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.