Hi guys and welcome to this WordPress tutorial this is Jamie from https://www.system22.net and https://web-design-and-tech-tips.com/ – well if you’re running a WordPress site you may get a lot of spam, a lot of comments that you need to delete. I’ve got a site up here that’s got six thousand, two hundred and ninety-six comments that have not been approved yet, and I’ve got a plug-in here that is called ‘delete pending comments’. I’ve used that before, it works pretty well but it doesn’t seem to be working very well for this, if you want to check it out just put delete pending comments into your plugin search, and it’ll come up, but this particular one hasn’t been updated for about six years, that may be possibly why it’s not working on this site here at the moment. I have used it in the past and it does work so you’re welcome to try it, but if this doesn’t work for you, and of course it’s another plugin that you’ve got to have on your site! There’s a different option.
What you need to do is log into your cPanel of your hosting. It may look slightly different for this, but it’ll have all the same features, and you need to go your PHPmyadmin and find the database that we need for this site, which I’ve got here, and just click on the database that pertains to your site. Be careful do not do this for any other database, make sure you’ve got the correct database. Go up to the SQL tab, and you can put in a piece of code, (DELETE FROM wp_comments WHERE comment_approved = 0 ), a short line of code, and it’s basically telling it to delete from the WP comments anything that has not been approved.
Once I’ve put that in I’m just going to hit go. It’s going to check that I actually want to do that. I certainly do! Okay and now it’s told me that six thousand, two hundred ninety seven rows have been effected. So it should have done that.
Let’s go back to our site and as you can see, there’s sixty two hundred comments. Let’s do a refresh and those should have disappeared. Now there we go, they’re all gone!
So that’s a quick and easy way of deleting a bunch of pending comments. Like I say you can try that plug-in if you wish I’ve got the site here. It’s called delete pending comments. It may work for you, but if it doesn’t you can use this other method. Like I say you need to go to your cPanel, into your PHPmyadmin. Find the database that relates to your site. Make sure you have the correct database. Once in there go to the SQL tab and put in this line of code (DELETE FROM wp_comments WHERE comment_approved = 0 )
I hope you found that useful. if you have please give it a thumbs up, share it and subscribe to our YouTube channel.
if you’re interested in web development we’ve got some great free web development courses, as well as some premium courses with some huge discounts for our YouTube subscribers, so do take a look! Thanks for watching, have a great day!