WordPress advanced comment spam clean up with search

In this article we’ll discuss a method for cleaning up spam comments from your WordPress database using phpMyAdmin.

If you followed along with our previous 320: WordPress comment spam clean up article this would be one of the more advanced methods mentioned in that article.

Our next article in this series 322: WordPress advanced comment spam clean up with query is an even more advanced method to help remove comment spam from your database.

Multiple entry removal via search

In our previous example from the first comment spam clean up article we noticed that a lot of the comment_author spam had the word “payday” in it with variations. You can utilize the Search functionality of phpMyAdmin to help in the process of finding all of these entries and quickly removing them.

  1. First you’ll need to get to your WordPress database via the phpMyAdmin interface
  2. Click on the Search tab at the top
  3. In the first field Word(s) or value(s) to search for: type %payday%.
    The reason you place a % symbol at the beginning and end of the word
    is because that means a wildcard character (any character at all).
    This way we’ll find entries for loan payday as well as payday loans.

    Leave the Find: option as the default of at least one of the words.

    In the Inside table(s): menu click on wp_comments to only search within that table

    Next to the Inside column: field enter in comment_author, then finally click Gowp-comments-search-values

  4. Click on Browse to see the results of your search wp-comments-search-browse
  5. You’ll notice we have 103 matches for our search, but we’re only seeing rows 0-29, because of the default entry beside Show: of only 30

    You can either go through one page at a time with 30 items per page, or if you prefer you can increase the limit beside Show: up to 103 to show all of our search results at once. You’ll want to also change the starting from row # option to 0 to begin at the first result, then click on Show:

  6. Now in this case because we’re looking at just the comment_author field, it’s very unlikely a legitimate comment user is going to use the word “payday” anywhere in their name. So scroll to the very bottom of the page and click on Check Allwp-comments-search-check-all

  7. Now that all entries have been checked, click on the Delete icon at the bottomwp-comments-search-check-all-delete
  8. Now scroll to the bottom of all the DELETE confirmations, and click Yes


    Finally you should see MySQL return an empty result set, as it’s trying to do our search again, but now all those entries have been removedwp-comments-search-confirm-delete-done

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Let us know!