Disable WordPress Comments & Trackbacks via MySQL Database

disable-wordpress-comments

WordPress comments can be a double-edged sword. Throw in trackbacks / pingbacks and you may find yourself in an unfriendly situation. Comment spam is notoriously exploited on WordPress platforms… largely due to naivety of website owners who have no idea what these terms mean or how to manage them effectively.

If you’re coming in on the tail-end of mitigating comment spam on a blog that has hundreds, even thousands of posts… disabling comments can be a bear. The WordPress administrative interface can be fickle about bulk editing more than 50 – 100 posts at once.

Below I’m going to show you how to quickly and swiftly disable the comments and pings for all posts in WordPress, through your MySQL database. I’m assuming you are already familiar with gaining access to the database of your WordPress website. And if you’re going to copy/paste/execute the code below without taking precautionary measures, please don’t get mad if things go awry.

PHPMyAdmin

  1. Launch PhpMyAdmin
  2. Select the WordPress database associated with your website
  3. Select the wp_posts table in the sidebar
  4. Once loaded, select the “SQL” tab in the main area
  5. Copy & paste the SQL code provided below into the SQL Run box
  6. Execute the code

If you were smart enough to change the default table prefix on your WordPress tables during installation, you’re going to have to change the reference to ‘wpblog_posts’ to reflect your table structure correctly. That’s all you need to do to close commenting and pingbacks on WordPress posts.

Back-peddling on Comment Spam

If you aren’t concerned with culling through thousands of lines of spam in an attempt to find legitimate comments, you can delete all comments very easily from your WordPress website.

  1. In the same PHPMyAdmin session, locate and select the wp_comments table from the sidebar
  2. Click on the “Operations” tab in the main area
  3. Click on “Empty the table (Truncate)” hyperlink

This will delete all contents of the wp_comments table, while keeping the structure intact.

Share the Post

About the Author

Tried and true professional with over 12+ years in Web development, project management, business development, branding, mobile computing, online marketing & sales, website design, social media and more.