? The Snippet:
UPDATE wp_posts SET comment_status = 'closed', ping_status = 'closed';
ℹ️ About the Snippet
If you want to disable all posts comments in WordPress. Then, there are few ways to do that. The simple solution can be by installing a Plugin which can disable the comments of any specific post or all the posts comments quickly without any coding but here comes a question i.e. “Why to install a plugin just to disable the comments?”. In fact, this is a valid question.
✅ How to use the Snippet
Most of the time a plugin contains a lot of other features and resource files which we don’t need for a particular task. As a result, this slows down the site’s speed and that delay can lose the traffic which means you can lose the leads, sales or subscribers.
To do this task simply, we can use a very small code snippet and the process is really simple. For this reason below are some steps explained to disable all posts comments in WordPress if you have a bit knowledge of using phpMyAdmin
Steps to use this code snippet to disable all posts comments:
- Open your website’s “phpMyAdmin”
- Select your Database
- Click on “SQL” Tab
- Paste the below code snippet in “Run SQL Query” Box
UPDATE wp_posts SET comment_status = 'closed', ping_status = 'closed';
Once you follow above mentioned steps, click on any of the post. When you scroll to the page. You’ll see instead of Comments Box it’ll show a message i.e “Comments are closed.”
In spite of the snippet shared in this guide. Let us know in the comments if you have any query. Don’t worry