Removing Images in a WordPress Post (Revisited)
A while back I wrote a semi-popular post on removing images from a WordPress post — today I am revisiting it. The original solution used the_content() and the output buffer to remove the images out of the post. Now that I have used WordPress a bit longer and candidly had to use the solution again and thought “what was I thinking” I thought I would share the cleaner solution:
. . . <?php echo preg_replace('/<img[^>]+./','',get_the_content()); ?> . . .
























Òscar said
June 26 2009 @ 2:52 am
Clean solution. Thanks for your work
tootapi said
July 27 2009 @ 12:59 am
yuo thats pretty good
Removing Images from a WordPress Post | Chris Schuld's Blog said
November 14 2009 @ 2:02 pm
[...] make sure you check out the updated version of this solution. Also, view my solution for removing everything but the [...]
ejjan said
December 8 2009 @ 3:17 pm
How can I have wordpress to generate html tags, like . Using this method I get “plain” text in the post.
Jeff said
February 28 2010 @ 10:50 pm
where i must add the code?