I've been using this code:
function remove_first_image ($content) {
if (!is_page() && !is_feed() && !is_feed()) {
$content = preg_replace("/<img[^>]+\>/i", "", $content, 1);
} return $content;
}
add_filter('the_content', 'remove_first_image');
for a few years now on my site that has almost 20,000 posts with images inserted at the top. I have a plugin that uses the first image as a featured image as well. sometimes I need to still insert a first image into content so it doesn't remove another image I have posted in there.
I would like to have the first image in the content removed completely in posts. so that in the future I don't have to insert a featured image into the content every time, just so other images show up when I have more than one image. So far I haven't been able to find anything on this except having to go into 20,000 posts and remove the first image.
Any ideas?
wp_posts.post_content
.SELECT ID, post_content FROM wp_posts LIMIT 1
;.post-content img:first-child{display:none;} //.post-content being your content wrapper
? Or, you want to remove it entirely?