Advertise on Site! You can Advertise on our site. Find out More

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.



Add a Comment

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