How To Remove Comments from Pages in WordPress

May 30, 2011 | How To

Comments are usually a welcome thing on your blog posts, but WordPress also allows for commenting on Pages. I can think of a few situations where the ability to comment on a page would come in handy, but by and large, I don’t want to see them on Pages. I don’t want to see some message indicating they’re closed, either. So, I had to find out how to remove comments from pages in WordPress.

There are a few different ways to remove comments from pages, and which one you will like best depends on you, your theme, and your willingness to “go into the code”.

Check the Theme Options for your Theme

First, check and see if your theme offers a theme options page, and if there is any ability to turn them “off” on pages there. Often times, the option to remove comments from pages exists there, and the theme author (in many cases) has coded the theme to not run the code at all if you’ve chosen to remove comments from pages. That means no trace discussion options are shown.

Edit the Discussion Section of the Page Edit Screen

The built-in-to-WordPress way to remove comments on a page is to uncheck the “Allow comments” and “Allow trackbacks and pingbacks” boxes in the Discussion section of the page edit screen. Save the page.

In some themes, this is all you need to do. In other themes, a message appears when you edit the discussion options. If you don’t mind that, then you’re done. But if you do, and would rather nothing appears on your pages, then you can…

Remove the Code in the Page.php File

Now, this sounds scarier than it really is. But be brave – you’re only looking for one line of code and you’re just going to take it out and save the change to the template.

In your Appearance menu, click Editor.

You’ll be taken to a screen that shows all your theme’s files listed at the far right, and the style.css will be displayed in the editor window in the midde of the screen.

Look down the list for the Page Template (shown at the right.) This is known as the default page template. Click it so that it is displayed in the editor window.

Now, scroll down the page and look for this line of code:

Now, delete that line! (Don’t delete ANYthing else!)

Save your changes by clicking the “Update File” button under the editor window. Now you won’t see any trace of comments on your pages, no matter what your settings say (because you’ve taken out the code that puts that functionality on the page!)

Comments Still Showing?

The most likely culprit is another page template that’s being used rather than the default. Most of the time you can tell what template is being used by editing the page and looking over to the right in the Page Attributes section. If there is another page template in use for this page, the Template drop-down box will read something other than “Default Template.”

Alternate page templates are pretty easy to identify by matching up what you see in the Template drop-down box with the name of the templates on your Editor screen. If your page is using an alternate page template, you simply need to remove the line of comment code from this page template, too. Save your changes and comments are all gone, buh-bye!

Share This