Auto delete posts based on content text

If you’re comfortable using phpMyAdmin, you can run this query:

DELETE FROM wp_posts WHERE post_content LIKE "%A line of same text that should be deleted%"

Replace with the text you’re wanting to remove, but keep the “% %” symbols. The percent symbols mean to search for that string anywhere inside the post content – even if there’s a bunch of other content before and after it.

If you have special characters in the line of text, you may need to escape them.

As with any query, make sure you have a current, working backup before you run this query. 🙂