---
title: "Completely disabling Comments from WordPress in the code"
description: "WordPress by default has comments enabled for most themes. The comments can be disabled in the WordPress Dashboard Settings &gt; Discussion page; however, this does not remove the comments from the..."
url: https://www.inmotionhosting.com/support/edu/wordpress/completely-remove-comments/
date: 2012-12-05
modified: 2021-08-16
author: "InMotion Hosting Contributor"
categories: ["WordPress Hosting", "WordPress Tutorials"]
type: post
lang: en
---

# Completely disabling Comments from WordPress in the code

[![removing-comments-completely-1](https://www.inmotionhosting.com/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-1.gif)](/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-1.gif)

WordPress by default has comments enabled for most themes. The comments can be disabled in the WordPress Dashboard **Settings** > **Discussion** page; however, this does not remove the comments from the page entirely. What happens when the comments are disabled is, the site will display **“Comments are closed”**. Comments can be removed completely be **Commenting out the lines of code** in the theme file that displays the Comments. The following code snippets are an example of the code used to display the comments.

<?php comments_template( '', true ); ?> <?php comments_template(); ?>
In this tutorial, HTML comment code will be used to disable the Comments from displaying in the **page.php** and **single.php** pages of WordPress. **The Main Index Template page will not be touched** in this tutorial because that template is the main template and can be disabled or changed in a different way. In this article, the **Birdsite** theme is used. The following will outline the steps to remove the comments.

**Important!** Editing the source code of a WordPress theme is a critical change. If the code is not edited correctly, **the site WILL break**. If you are not comfortable editing the code, please check with a developer before proceeding.

This article will explain how to remove the Comment code from the WordPress theme by using HTML comments.

### Disabling the Comments in the WordPress Theme code

1. [Log into the WordPress Dashboard](/support/edu/wordpress/logging-into-wordpress-dashboard/)
2. [![removing-comments-completely-2-wordpress](https://www.inmotionhosting.com/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-2.gif)](/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-2.gif) Navigate to the **Appearance** > **Editor** in the WordPress Dashboard to the left.
3. [![removing-comments-completely-3-wordpress](https://www.inmotionhosting.com/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-3.gif)](/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-3.gif) Select the **page Template (page.php)** in the **Templates** section to the right.
4. [![removing-comments-completely-4-wordpress](https://www.inmotionhosting.com/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-4.gif)](/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-4.gif) On the** Edit Themes** page, comment out the code that displays the Comments on the **page.php page**. In this case, the following code will be commented. <?php comments_template( '', true ); ?> **Change to** <!-- Begin Comment <?php comments_template( '', true ); ?> End Comment --> **Click Update page**.
5. [![removing-comments-completely-5-wordpress](https://www.inmotionhosting.com/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-5.gif)](/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-5.gif) Next, **Click** the **Single Post (single.php)**.
6. [![removing-comments-completely-6-wordpress](https://www.inmotionhosting.com/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-6.gif)](/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-6.gif) On the** Edit Themes** page, comment out the code that displays the Comments on the **single.php page**. In this case the following code will be commented. <?php comments_template(); ?> **Change to** <!-- Begin Comment <?php comments_template(); ?> End Comment --> **Click Update page**. [![removing-comments-completely-7-wordpress](https://www.inmotionhosting.com/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-7.gif)](/support/wp-content/uploads/2012/12/edu_wordpress_104_completely-removing-comments_removing-comments-completely-7.gif) Now the WordPress site will not display the comments on the single.php and the page.php pages.

This concludes this article on How to completely remove Comments from WordPress. To learn more about Widgets, please visit [Introduction to Plugins & Widgets](/support/)
