How to mass delete one line from all posts

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.

2 Answers
2

To use phpMyAdmin follow the steps below:

Login to phpMyAdmin panel and select your WordPress database.
Click on the SQL tab which will bring you to a page with a SQL query box.

Once you see the SQL query box, like the image shown below, you can run your SQL query there.

UPDATE wp_posts SET post_content = REPLACE (post_content, '<p style="text-align: center;"><img src="http://i.imgur.com/picture.jpg" alt="" /></p>', '');

phpmyadmin SQL Query box

Leave a Comment