321: 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.
- First you'll need to get to your WordPress database via the phpMyAdmin interface
- Click on the Search tab at the top
- 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 Go
- Click on Browse to see the results of your search
- 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:
- 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 All
- Now that all entries have been checked, click on the Delete icon at the bottom
- 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 removed