Remove first image from wordpress post

In many wordpress old site they used the first image as post or featured image so while showing the single post they not want to show the first image which is uploaded.

remove first image from wordpress post

remove first image from wordpress post

Using following code you can remove the first image from wordpress post. Please put following code in to functions.php file (you will find this file in your theme folder)

function remove_first_image ($content) {
if (!is_page() && !is_feed() && !is_feed() && !is_home()) {
$content = preg_replace("/<img[^>]+\>/i", "", $content, 1);
} return $content;
add_filter('the_content', 'remove_first_image');

when you see the single page of blog then you will not see the first image from blog post.


You may like following Articles!

  • CamelotWeb

    Great!!! thnx! Ive been looking for this code the whole day

  • giocobox

    I was looking for this code from some time. I kindly thank you! Appreciate! Best to you.

  • Gianpiero

    Hi and thanks for this solution. Can I ask you a question?
    Do you have a solution to do not show a thumbnail post at the top of it? If I insert a featured image in a post, automatically wordpress show it another time in the post. Why? Can you help me, please? Thanks

    • Wordpress API

      I will write post about this…If you have any issue then write to me on

  • Mr Bahis

    Hi, could this code be edited to work for a specific category only?