I am developing a theme and, after calling comments_template(), noticed that “Theme without comments.php is deprecated since version 3.0”.

I created a comments.php in the root of my theme and copied the default wp-includes/theme-compat/comments.php inside, which is perfectly fine for me. This core file will be removed in future versions of wordpress.

I am not sure if this is a good practice for theme development, though, as it is a complex bunch of code and it does not belong to the website development core features. I prefer wordpress to provide a default comments template.

I could deliver the theme without the ability to enable comments, but that is even worse.

I can be called lazy, but apart from that, shouldn’t there be a standard/default comments template?

1 Answer
1

You shouldn’t copy that file, precisely because it is too bulky. About half of it is implementation of submission form, which was entirely replaced with comment_form() function around that time.

So the answer why was it deprecated is roughly:

  1. Newer code is more compact
  2. Markup belongs in theme

For better and more relevant comments.php example look at core themes, such as twentyfifteen/comments.php.

Leave a Reply

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