Post comments not allowed if comment metabox removed

When building a site for clients it’s nice to clean out the Admin Dashboard screen of some of the unnecessary (and possibly dangerous) sections and checkboxes to avoid distractions when creating or editing their content. WordPress is flexible enough to allow sections, or meta boxes, to be easily removed through the use of the remove_meta_box function. The code can be added to the functions.php file.

One of the meta boxes that can be removed is the Comments or Discussion meta box. This box lives in the lower half of the Edit post screen. It allows you to set the post, or page, to accept or deny comments and trackbacks/pings. I’ve been working on a couple of sites for some clients and it was originally decided not to have comments at the launch. I removed the comments options from the post screen and removed the call to the comment template in the sites theme files.

Then the client changed their mind and would like comment functionality restored.┬áNow, it’s some time into the life of the site and the previously created posts are showing that comments are closed and the client want to add the ability for all posts to allow comments. It is easy to edit the theme files and add back in the “comment_template()” code and that would be that. However, the posts still show “Comments are closed”.

In Settings, Discussion there are no restrictions for commenting so it’s a little confusing that comments are not showing.

After working a little further on this I found the trick, which can be a little time consuming if you have lots of posts. Either edit, or quick edit, each affected post and tick the box that says “Allow Comments”.

Allow Comments in edit post
Allow Comments in edit post

After doing that for each post you should find that normal comment functionality is restored for all posts and for new projects I always try and identify the comment requirements at the outset.

Leave a Reply

Your email address will not be published. Required fields are marked *