WordPress Fix for Comment Date Same as Post Date Problem

Comments in WordPress are a way to interact with the site or the blog owner. By using comments users can share their feedback, make and enquiry about the post and also clear their doubts by asking questions regarding the post or article.

wordpress-comment

When you post any comment on any post then the date on which you have posted the comment should be shown in the submitted comment but I have seen in many themes there is an annoying bug where the post date of the article/post is displayed on every comment and its reply. I have noticed this issue in many WordPress themes both free as well paid. This is the error on the theme side and it occurs because of the improper coding (using incorrect function for time) by the theme developers. So here I am telling the solution to correct this issue.

How to Fix WordPress Post and Comment same Date Problem

1. Go to your WordPress theme folder

2. Here look for the file comments.php or functions.php (Depends on the theme to theme as in some themes the mentioned code is found in functions.php) and look for this code for the comment section <time><?php the_time(‘F j, Y’); ?></time>

Here in this particular code shown below it is found in functions.php

comment-php

functions.php file

3. Here replace this line

<time><?php the_time(‘F j, Y’); ?></time>

with

<time><?php comment_time(‘F j, Y’); ?></time>

Or you can simply replace the function the_time(‘F j, Y’); with comment_time(‘F j, Y’);

4. Save it, clear your wordpress cach and Bingo you are done. Now your comment date will be shown correctly according to when it was posted or replied.


Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.