WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to delete all wordpress comments with only one word. I found this mysql query to delete all comments at once, but that's not what I want to achieve:

DELETE FROM wp_comments WHERE comment_approved = '0'
share|improve this question
Thank you kindly. +1 !!! – RolandoMySQLDBA Feb 13 '13 at 15:16
up vote 1 down vote accepted

DISCLAIMER : Not a WordPress Developer, Just a MySQL DBA

If you have privileges to login to MySQL and query data you could collect all the comment_ID values that have one word.

SELECT comment_ID FROM wp_comments WHERE
REPLACE(TRIM(comment_content),' ','')=TRIM(comment_content);

You can test this by also seeing the comment_content

SELECT comment_ID,comment_content FROM wp_comments WHERE
REPLACE(TRIM(comment_content),' ','')=TRIM(comment_content);

Using the WordPress API, retrieve those comment_ID values and delete them.

Give it a Try !!!


Other posts have been given for bulk deleting of comments (none of these are my posts):

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.