How to add featured images to existing WordPress posts automatically

Martin Brinkmann
Feb 1, 2014
Updated • Feb 1, 2014
Development
|
1

Every now and then I'm running page speed analysis tools such as Google Page Speed or Yahoo's Yslow on the sites that I administrate to make sure that the sites load as fast as possible.

I spotted one issue recently that prolonged the loading time of index pages on Ghacks Technology News. The site is running a modified version of the Canvas theme, which displays thumbnail images on index pages such as the blog's homepage.

While that adds a visual component to the blog, it also increases the loading time of said pages more than necessary.

The reason? If no featured image is set, the first image added to the post itself will be taken as the thumbnail image. The problem here is that the original size of the image was used as the thumbnail image, instead of the separately created thumbnail image.

So, instead of having a size of 10 Kilobytes or less, some images had a size of 150 Kilobytes and more. Not good.

wordpress featured image

I realized quickly that I had to set a feature image for each post that had none to make WordPress use the smaller thumbnail image for index pages instead of the original image.

The problem that I ran into now was that I had no desire to go through all 15k posts that were published over the years here on the site to set a featured image.

After some digging around I found the WordPress add-on Easy Add Thumbnail. It takes care of the following two situations:

  • It will automatically set a featured image for new posts that you create, so that you do not have to do so manually anymore. That is, unless you want to select a different featured image for a post.
  • For existing posts, featured images are set dynamically on first page load on the front end. As soon as users load a page where thumbnail images are shown, featured images are set for those posts. This is a one-time operation only, as featured images are saved the usual way by the plugin.

The plugin uses WordPress' standard functions to set featured images. This is identical to setting featured images manually on the site, and only works if at least one image is attached to a post.

Verdict

If you are in the same situation and have not set featured posts yet on your site, or switched to a theme recently that supports featured posts, then you may want to give Easy Add Thumbnail a try, as it resolves the issue elegantly for you.

Advertisement

Previous Post: «
Next Post: «

Comments

  1. Jack said on February 4, 2014 at 9:13 pm
    Reply

    Thanks. I found the GTmetrix link very helpful.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.