Results 1 to 3 of 3
Thread: preg_replace for MySQL?
Apr 5, 2014, 18:50 #1
preg_replace for MySQL?
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
Apr 6, 2014, 04:48 #2
- Join Date
- Jul 2002
- Toronto, Canada
- 60 Post(s)
- 3 Thread(s)
Apr 8, 2014, 08:12 #3