I need to delete some content from all posts.
Every post starts with this line:
<p style="text-align: center;"><img src="http://i.imgur.com/picture.jpg" alt="" /></p>
So I want to delete this line from all posts from my database at once.
I know I can edit it in phpmyadmin but I do not know how to do it.
Here is how every post looks:
<p style="text-align: center;"><img src="http://i.imgur.com/picture.jpg" alt="" /></p>
<p style="text-align: center;">here is some text.</p>
So basically I want to mass remove this very line:
<p style="text-align: center;"><img src="http://i.imgur.com/picture.jpg" alt="" /></p>
from every post on the site.
Postscriptum, I am completely newbie.
UPDATE wp_posts SET post_content = REPLACE( post_content, 'from', 'to' ) WHERE post_type = 'post' AND ID = 123;
. Where you adjust the from and to values, the ID and post type and thewp_posts
table name. You can then remove theID
andpost_type
restrictions after testing. But remember to BACKUP up your db before!