BLACK FRIDAY SALE IS LIVE !!!!!

Default Fallback Image for WordPress Post Thumbnails

How do I change the default post thumbnail for WordPress? Let’s use this article to discover the answer. Skynats responds to inquiries about WordPress as part of our Server Management Services.

How can the default fallback image for WordPress post thumbnails be set?

A WordPress theme feature called post thumbnails also referred to as featured pictures, enables users to link an image to a blog post or article. Based on the theme, this image is then added to the homepage, archives, or sidebar widgets. If we fail to include one, the picture won’t be in the article. The layout will therefore appear flawed.

When no post thumbnail is found, the default fallback image will be used to avoid such occurrences. Let’s examine how to quickly set up a fallback image for WordPress post thumbnails.

Solution 1

  1. To begin, you will need to download the WordPress Default Featured Image plugin and then install it.
  2. To change the plugin settings, navigate to the Settings » Media page.
  3. To upload or choose the image we want to use as the fallback post thumbnail, click the ‘Select default featured image’ option on the new page.
  4. Select “Save changes” from the menu.
  5. Finally, we can go to the website to see how it works.

Solution 2

This approach makes use of codes on the WordPress theme files. Setting the default fallback image for WordPress post thumbnails involves the steps listed below:

  1. First, make the image that we want to use the default image.
  2. Then, using any FTP client, upload it to the images folder of the WordPress theme. The images folder for the theme is located in /wp-content/themes/yur-theme/. If it doesn’t already have an image, we’ll need to make one.
  3. If a post lacks its post thumbnail, instruct WordPress to search for this image. Post thumbnails can be found displayed in multiple locations across the WordPress theme. Look for the post thumbnail() in the theme files. Generally, it can be found in single.php, archive.php, or content templates.

Include the code below where you want the thumbnail to appear.

<?php if( has_post_thumbnail() ) {the_post_thumbnail();} else{ ?><img
src=”<?php bloginfo(‘template_directory’); ?>/images/default-image.jpg”alt=”<?

php the_title(); ?>”/><?php } ?>
  1. Additionally, substitute our image file name for default-image.jpg.
  1. To see it in action, we can finally visit the website.

Are you looking for an answer to another query? Contact our technical support team.

Liked!! Share the post.

Share on facebook
Share on twitter
Share on linkedin
Share on reddit

Get Support right now!

Start server management with our 24x7 monitoring and active support team

Can't get what you are looking for?

Available 24x7 for emergency support.