Default fallback featured image for posts and pages

Web & Digital design and development

Specializing in custom WordPress site development and graphic design

There are times when your theme is set up to show uploaded featured images in blog and page headers. There could be times, though, that a user might not be able or want to upload a featured image. In this case, it might be preferable to show a predefined fallback image to the viewer. Here is how to do it.

Install the Default featured image plugin and activate it. Then head to Settings -> Media, scroll down to the Default featured image area and upload a default image for your blogs and pages. After doing that, content that does not have an uploaded featured image attached but is set to show it on the page will use the default uploaded image instead.

You can customize the behavior of the plugin, as well. For example, to exclude the default image from pages, you would add the following code to your functions.php of a functionality plugin.

function dfi_skip_page ( $dfi_id, $post_id ) {
  if ( is_page() ) {
    return 0; // invalid id
  return $dfi_id; // the original featured image id
add_filter( 'dfi_thumbnail_id', 'dfi_skip_page', 10 , 2 );

There are other customizations you can apply, head over to the FAQ area of the plugin to have a look!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Ready to get started?

Contact me today to learn how I can help grow your business.