WordPress theme code – Duplicate Featured Image on Post and HomePage Fix


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:


function wpi_image_content_filter($content){



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