Support » Networking WordPress » How can I remove thousands of Spam comments?

  • Hi

    My host, Siteground, has shut down my site until I clear all of the Spam comments out.

    I have stopped new registrations. I have installed a disable comments plugin. How do I get rid of thousands of spam comments from 300+ multisites from network admin? None of them will have been approved. If necessary I am happy to delete all comments.

    Is there a way to do it without having to login to each individual site or find each individual comments table in myPHPadmin?

    Many thanks, Mike.

    [Please stop posting the same question in multiple, pre-existing, topics.]

Viewing 1 replies (of 1 total)
  • I use this mu-plugin snippet on an install with a couple hundred blogs. I’ve seen it clear out towsands of spam comments and empty trashes. It may time out if a site has gadzillions of spam, I don’t know. I can’t test that.

    Plunk this snippet into a php file in your “mu-plugins” folder. It’ll run when you click the “Update Network” button.

    function my_spam_be_gone( $blog_id ) {
    	global $wpdb;
    	$blog_prefix = $wpdb->get_blog_prefix( $blog_id );
    			$wpdb->query( "DELETE FROM {$blog_prefix}comments WHERE comment_approved = 'spam' OR comment_approved = 'trash'" );
    add_action( 'wpmu_upgrade_site', 'my_spam_be_gone' );
Viewing 1 replies (of 1 total)
  • The topic ‘How can I remove thousands of Spam comments?’ is closed to new replies.