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 trying to setup a default fallback featured image on my website to ensure consistency with images being displayed for every post, even when an image is not embedded in the post. I've tried a number of plugins - Default Post Thumb and Default Thumb, however neither of these seemed to work. I'm using WP 3.4 and the Suffusion Theme 4.2.2 on the site which can be seen at http://www.aliveradio.net/ I'm not very capable at editing basecode and would prefer to work with plugins, however if anyone could help with code alterations I'd be happy to give it a go.

Thank-you in advance for any help you can provide.

share|improve this question

One simple method is to filter post_thumbnail_html, to add in a default image link:

function wpse55748_filter_post_thumbnail_html( $html ) {
    // If there is no post thumbnail,
    // Return a default image
    if ( '' == $html ) {
        return '<img src="' . get_template_directory_uri() . '/images/default-thumbnail.png" width="150px" height="100px" class="image-size-name" />';
    // Else, return the post thumbnail
    return $html;
add_filter( 'post_thumbnail_html', 'wpse55748_filter_post_thumbnail_html' );

You can make this filter more complex, but this should get you started.

share|improve this answer
Hi, Thanks for your feedback - I've looked at my functions.php document and can't see this argument anywhere - can you give me any advice as to where I might find this argument/ element? – Alive Radio Jun 17 '12 at 22:13
What "argument/element" do you mean? – Chip Bennett Jun 17 '12 at 22:55
Where to add the code you've quoted above - do I create a new file or edit an existing one as I can't find post_thumbnail_html anywhere? I may have overlooked something as I'm new to this but any help is greatly appreciated. – Alive Radio Jun 19 '12 at 8:31
Callbacks such as this one belong in your Theme's functions.php file. – Chip Bennett Jun 19 '12 at 13:22

while you say you'd like to use a plugin ... there is a very easy method to do what you want

basically inside your theme folder you will want to open and edit a file called single.php

you want to look for this code


and replace it with this code (changing the path_to/default_image.jpg)

<?php if ( has_post_thumbnail() ) {  
} else { ?>  
<img src="<?php bloginfo('template_directory'); ?>/images/default-image.jpg" alt="<?php the_title(); ?>" />  
<?php } ?>`

If you find your site breaks / page doesn't load then you may need to remove the the opening

<?php and closing   ?>  

source: http://www.wpbeginner.com/wp-themes/how-to-set-a-default-fallback-image-for-wordpress-post-thumbnails/

Hope that helps?



share|improve this answer

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.