Don’t Worry, You’re In The Right Place
A lot of these posts were originally on So if you found them through search engines or clicking around, this is their new home :). Enjoy!

WP Snippet – Duplicate Featured Image on Post and HomePage Fix

So I was working on a project and I added a featured image to the post. There was also an image in the post directly (in the single page view — single.php). So low and behold when I went to the homepage I saw the featured image display perfectly how I wanted and then BAM! the same image right next to it. WHY??? Well I didn’t have anything that told wordpress to display the featured image on the home/archive/category page ONLY and not the images in the post!!!

Until now…

Here’s the code snippet to prevent post images from displaying on the homepage:

[code language=”php”]

function wpi_image_content_filter($content){

if (is_home() || is_front_page()){
$content = preg_replace("/<img[^>]+>/i", "", $content);

return $content;

Add that to your functions.php file and you should be good to go!

About the Author
What's UP! This is my site, I write 99% of the articles on here. I'm also the owner of I help out a lot of developers and designers getting into the web game. Helping is fun for me, so feel free to ask me any questions! I've made courses and have a membership as well to help get you on your feet!

0 comments on WP Snippet – Duplicate Featured Image on Post and HomePage Fix

  1. Gift trade says:

    Can I just say what a relief to find someone who actually knows what theyre talking about on the internet. You definitely know how to bring an issue to light and make it important. More people need to read this and understand this side of the story. I cant believe youre not more popular because you definitely have the gift.

  2. What a good article. Thank you and keep up the fantastic work.

  3. This really answered my problem, thank you!

  4. Kingsley says:

    Hi sir… This did not work for me

    1. Jonathan says:

      Care to share =) Not working on the homepage? At All? …

  5. sanel says:

    I still cant solve this. Is thre a special place to put this code in functions.php. I added it at the bottom and still cant solve the problem. In my single post view I see featured image and then duplicate same image bellow. For example
    I would like to remove featured image from single post. Please help.

    1. Jonathan says:

      Are you using Genesis Child Theme? A lot of times the featured image can be displaying because of the theme. You can try to add is_single() to the if statement and see if that works. I clicked the link but got a 404 page.

      Cool site btw. =)

  6. Tamara says:

    Hi. i have a similar problem, except that i have a static home page and my posts page is called articles. i also have categories creating submenu items under the articles main menu item. each post has an image as well as a set featured image, which both display on the main posts page (articles) and the category pages (the sub menu items).

    i have tried the code above and it removes the post image instead of the featured image, but only on the main posts page not on the category pages.

    how can i fix this?

    1. Jonathan says:

      Hi! Just change the conditionals to match the type of pages you want to target. Right now it targets the home page but you can add || is_archive() etc. depending on what you want. Here’s a link to what you can do:

  7. Kyle Taylor says:

    Your code fixed my home page duplicate photo – but I get the same duplicate problem on the single post pages as well.

    1. Jonathan says:

      You’ll have to add is_single() to the conditional statements in the code as well.

  8. Darin H says:

    I am pretty new to this whole Genesis bit.

    I am using the Streamline Child Theme and placed an image in the post and it appeared at the top without a Featured Image being listed.

    The most recent post is the issue.

  9. Teresa says:

    I have been looking for days on how to fix the double image and I finally found your site. Thank you so much for the great instructions for those of us who are code challenged. 🙂 Again, thank you!!!

  10. Kate says:

    I feel like such an idiot! I just found a really, really simple fix to the double-triple images problem. There is a setting for archives where I can turn off the content. As soon as I turn off content, it only displays one image and a short excerpt, which is perfect for me. Disregard my prior post. Thank you, Jonathon. I’m giving you credit for this fix because in order to type a concise problem for you, I had to dig deeper than I had before. The curse of all newbies, eh?

  11. Wow, thank you. This problem was driving me crazy. I’m new to Genesis and use News Pro, and couldn’t understand why the News Pro demo site shows posts with Featured Images and an image inside the post. I thought that was a built-in feature that would just work automatically. But doing it myself I always got duplicates on the posts summary page.

    Anyway, your fix solved the issue and I can’t thank you enough.



    1. Jonathan says:

      =) I love these comments, thanks so much!!

  12. RV says:

    Hello there, ive been endlessly searching for this fix. I tried this and it works but it removes all the images and videos on my posts… can you help me fix it? I just need to remove double featured image showing on my post. What happened was, there are two featured image on the top of my post. Please please help me,i have 2000 articles and I cant do it one by one. 🙁

    1. Jonathan says:

      Sounds like a theme issue. This snippet of code is really only meant for the archive pages. What theme are you using? Check to see if there’s an option to turn off the featured image within the single page post.

  13. Marcela says:

    I’ve been searching for this all over the internet and your were the only one to solve my problem!!! Thank you SO MUCH!!

  14. Des Walsh says:

    Worked for me. Thanks so much – that was driving me batty!

    1. Jonathan says:

      Very Welcome! =)

  15. Naser Mohd Baig says:

    Hi Jonathan,

    The code doesn’t seem to solve my problem. Please check this image: I am getting the image which I added in my post on the homepage as well and it links to the article. I have set full content on the homepage so it looks weird to have two images.

    Please help

    P.S., I am using Streamline Pro Genesis Child theme if it helps


Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top