How to replace a not found featured image in WordPress
Learn how to automatically replace a not found external featured image in WordPress.2020-12-29
1. Create a new post
To get started, access the WordPress admin panel. In the left side menu click on "Posts". And then click on the "Add New" button. The post editor will be displayed and we will begin to fill in the fields as shown below.
2. Define a wrong image address
I defined the title of my post as "Not found image". And in the second box "Featured image", I wrote an invalid image address in the "Image URL" field, that is, there is no image at that address. It doesn't matter if it was a typo or if there was actually an image there and it was removed, in both cases we will not have a featured image, which can have negative impacts on the layout. If you do not have the "Image URL" field in the editor, you will need to install the Featured Image from URL (FIFU) plugin.
3. Check the post
After we publish our post and access it, we see that the image could not be loaded and, for this reason, the browser displayed the text "Wrong image address", which is the value we defined for the alt attribute. However, as we will see below, it is possible to define a default image to replace an image not found.
4. Get an image URL
To replace the missing images from your site, you can use any image from the Internet. In my case, I will use the image on the side, which I generated on Vampixel. Copy the address of your image.
5. Set the image URL
Now access the Featured Image from URL (FIFU) plugin settings. Look for the "Featured image" tab and then the "Replace Not Found Image" feature. There will be a field for entering the image URL. Then paste the image address there and click on "Submit".
6. Check the post list
If you access your list of posts now, you will see that the post still does not display a featured image. This is because the Featured Image from URL plugin replaces the image for visitors only. So the replacement has no effect on the WordPress admin panel.
7. Check the post (again)
If you access the post again, you will see that the image that did not exist has been replaced by the image defined in the FIFU plugin settings. This happens at run time. This means that the website tries to display the image defined as featured image and, in the event of an internal error (404, not found), the plugin replaces the image address. The trigger is an error that is not visible to visitors. But internally, in the database, the post remains linked to the image that does not exist.