Disable WordPress Comments without Plugin

Hey guys, welcome, In this article I’ll guide you through the process of turning off all comments in WordPress and removing recent comments from your WordPress pages.

Disabling comments can be a great solution if you prefer not to have a commenting system on your website.

By following these steps, you’ll be able to optimize your WordPress site by removing the comments section and improving user experience.

Let’s dive in!

Before we dive into the technical details, let’s understand why you might want to disable comments on your WordPress website.

While comments can enhance engagement and improve the discussions, some website owners prefer to eliminate them for various reasons.

These can include reducing spam, eliminating distractions, or focusing on alternative forms of user interaction such as contact forms or social media channels.

To turn off comments on pages in WordPress, you can follow these simple and easy steps:

Step 1: Log in to your WordPress Dashboard

Enter your login credentials to access the WordPress admin panel.

Step 2: Navigate to the Discussion Settings

In the WordPress Dashboard, go to “Settings” and click on “Discussion.

Discussion Settings in WordPress

Under the “Default article settings” section, uncheck the box that says “Allow people to submit comments on new pages.” This will disable comments on all future pages.

Disable Allow People to Submit Comments

If you want to disable comments on existing pages, go to the “All Pages” section and select the pages you wish to modify.

From the “Bulk Actions” dropdown menu, choose “Edit” and click the “Apply” button. Then, find the “Comments” section and select “Do not allow” from the dropdown menu.

Finally, click the “Update” button to save the changes.

Disable Comments in Existing Pages

To remove recent comments from your WordPress pages, we’ll modify the code in your theme’s functions.php file.

You can follow these steps:

Step 1: Access the functions.php File

In your WordPress Dashboard, go to “Appearance” and click on “Theme Editor.” On the right side, locate and click on the functions.php file to open the code editor.

Step 2: Edit the functions.php File

Copy and paste the following code snippet at the end of the functions.php file:

function remove_recent_comments() {
    global $wp_widget_factory;
    remove_action('wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style'));
}
add_action('widgets_init', 'remove_recent_comments');

Step 3: Save the Changes

Click the “Update File” button to save the changes made to the functions.php file.

If you wish to further optimize your WordPress site’s commenting system, you can consider the following steps:

  • Disable comments on posts: Similar to disabling comments on pages, you can follow the same process to turn off comments on future posts and existing posts in WordPress.
  • Remove the comments box from all pages: In addition to disabling comments on pages, you may want to remove the comment box entirely.
    To achieve this, you can edit your theme’s page template files, specifically the page.php file.
    Locate the section that contains the comment form code and either remove it or comment it out by adding two forward slashes at the beginning of the line.
  • Disable the discussion settings: In the WordPress Discussion Settings, you can explore other options such as disabling trackbacks and pingbacks, setting comment moderation, and enabling comment blacklisting to enhance control over your comment system.

By following the steps outlined in this guide, you can easily turn off all comments in WordPress, remove recent comments from your WordPress pages, and optimize your website’s commenting system.

Remember, by customizing your commenting system, you can shape your website’s user experience according to your preferences while maintaining a clean and focused environment for your visitors.

Implementing these changes will not only streamline your WordPress site but also improve its SEO ranking by reducing unnecessary clutter and distractions.

Enjoy a more tailored user experience and let your content shine without the distraction of comments!

Remember, as with any modifications to your WordPress site, it’s essential to back up your files and double-check the changes to avoid any unintended consequences.

Now go ahead and take control of your comment system, making your website truly your own.


Source link