How To Remove Images From Post Content In WordPress
Hi Friends, Some days ago I was working on one project in which I have to show wordpress post on home page which is already showing by default in wordpress but my client having images in all posts at start and client want to show images in different style , So I have to remove images from content to show content simply on home page. So I found one code by which we can easily remove images from post content without any problems.
So to remove images from WordPress post content you just have to use code given below ;
<?php $content = get_the_content(); $postOutput = preg_replace('/<img[^>]+./','', $content); echo $postOutput;?>
Ok, So now use code shown above in while loop of index file or wherever but it must be exists in while loop and this will print your content without image. This is very small thing but it is very useful for some time when we need it. Anyway if you are having any problem with this code, then post it in content, I will try to solve it.