• Hello!

    Wordpress latest stable here, 6.1.1, on a Debian Buster server.

    A blog I tend to has over 10k comments in the trash folder. I suspect it’s a combination of a wave of spam comments, and an option in the antispam to not directly delete spam comments, but trash them.

    I can’t delete them properly in the wordpress admin. If I go into Admin > Comments > Trash > “Empty trash” button, because of the limits on php execution time, a 500 internal error shows up (nothing serious, it’s just the server interrupting the job, the blog works just fine), and only around 100 comments have been deleted, max.

    I want to bulk delete the “Trash” comments with phpmyadmin, I figure an SQL command will do the job better.

    However, I cannot find RECENT documentation on the topic. At best, I find pages from 2018 like this one: https://www.crybit.com/managing-comments-wordpress/

    Maybe it is still valid, but maybe wordpress has changed so much that the advice they give has become obsolete, and I would risk to cause problems.

    May I humbly ask if the following command would still do the job, without risking to produce problems?

    delete * from wp_comments WHERE comment_approved='trash';

    Here’s how one of those comments I wish to delete looks like in wp_comments : https://imgur.com/a/Er4WBK9 (phpmyadmin screenshot)
    I *think* that command would still work, there’s indeed the “comment_approved” column with the “trahs” value, but I am not 100% positive I’m not missing something, I’m waaaay out of my field.

    Thanks a lot if someone can give that confirmation! And have a nice day 🙂

    • This topic was modified 3 years, 5 months ago by Sabinooo.
    • This topic was modified 3 years, 5 months ago by Sabinooo.
Viewing 1 replies (of 1 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Check wp_commentmeta as well. If there are rows there, you’ll need to match connect them to comments via the comment ID and delete them as well.

    Be sure to back up your database before doing anything!

Viewing 1 replies (of 1 total)

The topic ‘Bulk deleting “trash” comments with phpmyadmin’ is closed to new replies.