masm50 — 2014-04-05T20:50:40-04:00 — #1
I've built a Wordpress site up with thousands of posts where I've inserted images using the traditional method into the post content itself.
I'm now moved to a different theme, and have made the first image for each post the featured image (which I want to keep), but I now would like to remove the first image from the_content.
I have found that I can remove the first image (with or without captions) on the fly by instead of using the_content(), doing this:
echo preg_replace("/\\[caption .+?\\[\\/caption\\]|\\< *[img][^\\>]*[.]*\\>/i","",get_the_content(),1);
Is there some way I can run this command on the database to actually remove those images?
Thanks for any pointers
r937 — 2014-04-06T07:48:07-04:00 — #2
there's nothing like that in mysql, you'll have to do it with php
masm50 — 2014-04-08T11:12:58-04:00 — #3
I thought as much - thanks for the reply!
system — 2014-10-08T01:52:39-04:00 — #4
This topic is now closed. New replies are no longer allowed.