How to Disable Comments on WordPress Blog

0
125

It can be done easily if you are running a WordPress blog and want to turn off the comments. You need to follow these steps.

  1. Log into your WordPress dashboard.
  2. Go to Settings > Discussion
  3. Toggle off “Allow visitors to post comments”.
  4. Make sure the “Comments enabled” box is checked
  5. Click Save Changes
  6. That’s all! You have successfully disabled comments on your WordPress blog.

on your website

In the previous article, we showed you how to install WordPress on your website. In this article, we will show you how to turn off WordPress comments on your website.

Many people come to our site looking for help with installing WordPress. One of the first questions they ask is how to turn off comments on their WordPress site. We will show you how to accomplish this.

We will also examine the pros and cons of disabling comments on your WordPress site.

You can turn off the comments section on WordPress sites without turning off comments on the actual posts. You can also have WordPress only allow certain commenters on certain posts. This makes it possible to enable constructive or supportive words but keep out trolls and people who will spam. This is particularly useful on blogs since many trolls try to comment everywhere they can.

WordPress

Disable comments on specific pages or posts

You might want to turn off comments on a specific page or post for several reasons. It could be because you want to prevent spam or limit the number of comments on a stick. Whatever the reason, disabling comments is a quick and easy way to accomplish this.

To do this, you can add the following code to your functions.php file located in the wp-content folder:

Disable comments for all posts

Many WordPress users come to us asking how to turn off comments on their WordPress blogs. Sometimes, they want to disable them on specific pages or posts.

You can also turn off comments for an entire blog by setting the ‘comments_open’ option to false. To turn off comments on specific pages or posts, you must edit your theme’s functions.php file.

Step 1: Disable comments on the homepage

Let’s begin by disabling comments on the home page of your WordPress site. To do this, follow these steps:

Click on the “Appearance” tab on your dashboard.

Scroll down and find “Settings” on the left side.

Click on the “Reading” tab.

Scroll down to the “Comments” section.

Now, change the “Comment” dropdown menu from “All Pages” to “Home”.

Step 2: Disable comments on a single post

Let’s continue turning off comments on a single post. To do this, follow these steps:

Click on the “Appearance” tab on your dashboard.

Scroll down and find “Settings” on the left side.

Click on the “Reading” tab.

Scroll down to the “Comments” section.

Now, change the “Comment” dropdown menu to “Post”.

Step 3: Disable comments on all posts

Let’s finish disabling comments on your entire blog. To do this, follow these steps:

Click on the “Appearance” tab on your dashboard.

Scroll down and find “Settings” on the left side.

Click on the “Reading” tab.

Scroll down to the “Comments” section.

Change the “Comment” dropdown menu to “None”.

That’s all there is to it. Now, you should have no comments on your entire blog.

Block comment notifications

You must log in to your WordPress dashboard and navigate to Settings → Discussion. There, you’ll see a list of different types of comments. You’ll also notice a list of notifications to appear.

You can either turn off all comment notifications or block specific ones. For example, you can turn off all notifications except for spam comments.

Disallow comments on a post from a specific user

We already know how to install WordPress, so let’s jump straight into how to turn off comments on a post.

WordPress has two methods for disabling comments on a post:

  1. Go to Settings > Discussion and select the “Comments are closed” option.
  2. Create a filter to detect a statement by a specific user and then remove it.

The first method is easy to implement, but the second method is more powerful.

For the second method, we will create a filter that detects comments by a specific user and removes them from the post.

Let’s go back to our camp and look at the code.

Here is what we want to do:

First, we need to create a new filter called “disable_comments_by_user.”

Then, we need to add a new filter that detects the comment by the user’s name.

The final step is to delete the comment.

We must create a new filter named “disable_comments_by_user” to create the filter.

The filter should accept a value, which is the user’s name.

Then, we need to add a new function. This function will check if the comment is by a specific user.

Once we have done this, we need to add the filter to the action, which is the “wp_insert_comment.”

To delete the comment, we need to add the line “$comment->comment_post_ID = 0;”

Now that we have completed our new filter, let’s test it.

To test the filter, let’s add a new comment to the post and see if it deletes it.

It doesn’t.

So, we need to add another new function to our filter.

We need to add a new function to our filter to do this. Let’s add a new part named “filter_input” and accept the input as a variable.

Now, let’s add a new function named “validate_comment.”

This function will validate the comment. We will validate it by checking whether the word is by a specific user.

Let’s add a new function named “is_comment_by.”

This function will check whether the comment is by a specific user.

Then, we need to add a new function to the previous position. This new function will return the name of the user.

Finally, we need to add a new condition to the previous function. This condition will return the user’s name if it is the author’s.

Now, let’s test the new function.

This time, we will create a new comment and see if the new word is deleted.

It was.

So, we now know that the new function works. Next, let’s add another part to our filter.

This new function will return the name of the user.

We need to add a new condition to this new function.

Then, we need to add a new function to the previous position. This new function will return the name of the user.

We need to add a new condition to this new function.

Now, let’s test our filter.

It worked.

We need to add a new condition to this new function to ensure everything works.

Then, we need to add a new function to the previous position.

Now, let’s test our filter again.

Disallow comments from a specific IP address

This is one of the most common requests that we receive. If you have a popular website that we do not host, you will likely have many visitors from the same IP address. This makes your website vulnerable to spam comments, reviews, and malicious activities.

The easiest way to do this is by setting up a firewall. If you use a hosting package with cPanel, you can add a filter to block comments from the offending IP address.

If you are not using cPanel, you can use a firewall such as SquidGuard or OpenDNS.

Delete comments

We’ll start by deleting the words and then explain how to fix it later.

To delete the comments, you must go into the comments section of the Posts page.

If you’re using WordPress 3.4 or higher, you’ll see a dropdown menu in the Comments section.

Select the All tab, and then click on Delete.

If using WordPress 3.3 or lower, go into the comment.php file.

Open the comment.php file, and locate the remove_filter(‘pre_comment_content’, ‘wp_filter_post_content’) line.

To delete comments, add a return before the line.

Save the comment.php file; you can delete the comments now.

To delete the comments and restore the previous functionality, you’ll need to edit the functions.php file.

Locate the remove_filter( ‘pre_comment_content’, ‘wp_filter_post_content’ ); line.

Add a return after the line.

Save the functions.php file, and you should be good to go.

Top frequently Disable Comments on WordPress

Q: Why should I turn off comments on my blog?

A: Comments can be very annoying to both readers and authors of your content. Comments can be used to advertise websites and spam blogs, leading to unwanted advertising.

Q: Can I still view my blog if I turned off comments?

A: Yes. Disabling comments will not affect the ability to view or comment on your content.

Q: Do I need to create a new blog to turn off comments?

A: No. You can easily remove the comments feature by clicking the “Plugins” menu item, then clicking “Settings,” and then clicking “Discussion.” Then, find the “Commenting” tab. Click the link next to the word “Comments.” Uncheck the box next to “Allow people to comment on posts.” You are done!

Q: Do you know how to turn off comments on my other blog?

A: Yes. You must go to your blog dashboard’s “Settings” page and select the “Discussion” section. Then, locate the area with the word “Commenting” and uncheck the box next to “Allow people to comment on posts.” Then click the “Save Changes” button.

Q: Can you explain more about what’s happening in the code when you turn off comments?

A: When you turn off the commenting feature, a series of code is executed. The code is triggered when you click the “Disable Comments” button on the “Settings” page. The comment feature is turned back on if you click the “Enable Comments” button.

 Top Myths about Disable Comments on WordPress

  1. Hypothyroidism is rare.
  2. Hypothyroidism only occurs in older adults.
  3. Hypothyroidism can only occur as a result of an autoimmune problem.
  4. Hypothyroidism has no symptoms.
  5. Hypothyroidism is always a chronic condition.

Conclusion

A few months ago, I asked how to turn off comments on a WordPress blog. This was a request from someone who wanted to keep their comments section for family members only.

So, I figured, what better way to share my answer than to write a blog post about it?

If you have a WordPress blog and are unsure how to remove comments, I have a simple tutorial that can show you how.

First, let’s go into Settings > Discussion and turn off comments completely.