Mass delete bbpress spam posts

Having neglected a wordpress/bbpress installation for a bit I had the problem of dumping tens of thousands of spam and trash and pending items from bbpress.

I took a look at the database:

HeidiSQL WordPress wp_posts

To get things done more quickly than using the web browser I deleted the items as follows.

I created a php script to retrieve the IDs of the items I needed to remove:

I ran this code as follows:

Then used that output as input for the following:

I repeated the process several times changing post_status in the SQL to trash, pending, auto-draft etc. And afterwards optimised the database tables i.e. OPTIMIZE TABLE wp_posts;

Not perfect or pretty but got the job done while I implemented anti-spam measures.

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">