How to remove date and time from Comments in Wordpress

How to remove date and time from Comments in WordPress

Some people believe that removing dates from comments in their posts can improve their search engine rankings while others think it otherwise. As far as removing date from wordpress posts is concerned, you should never do it. And I would hold my same opinion for wordpress comments as well. Yes, it is different thing that the dates of posts keep more importance than dates of comments.

Should you remove date from comments in WordPress?
People who are in support of removing datetime from comment metadata argue that date is the only field which tells the user that how many days/months/years back the article might have written. And if they remove this datetime then the user will take that article as everlasting and evergreen. They will treat the content as fresh and updated. But don’t you think that this is a bluff with your blog’s readers?

Suppose an article has its first comment in September 2006 then whether you pin that article on front page of your blog, it is obvious to your reader that the article was written in or prior to September 2006. But I would say that if your content is good then the dates will not do any negative to you.

Secondly, I can see many bloggers re-publish their old articles, so that the published date gets changed. I would suggest to them that instead of showing published date in posts to users, show them the updated date. If you are going with this approach then there is no need of removing the comment-dates.

If you have made your mind to remove the comments then please read below.

How to remove Date from Comments in WordPress

Here, we are going to show three methods by which the datetime can be removed.

Method One – Using Custom Code

1. Login to your wordpress dashboard.

2. Go in Themes –> Editor.

remove date from comments wordpress
Appearance Editor

3. Open functions.php file.

4. Paste below code at its bottom. Please take backup of your file first before doing any changes in functions.php file.

// Remove date of comment
function bp_remove_comment_date($date, $d, $comment) { 
    if ( !is_admin() ) {
        return;
    } else { 
        return $date;
    }
}
add_filter( 'get_comment_date', 'bp_remove_comment_date', 10, 3);

// Remove time of comment
function bp_remove_comment_time($date, $d, $comment) { 
    if ( !is_admin() ) {
            return;
    } else { 
            return $date;
    }
}
add_filter( 'get_comment_time', 'bp_remove_comment_time', 10, 3);
 

5. Save the file.

6. Open your website and see if the datetime has disappeared from comments.

7. You will see that the date and time has disappeared but you can see word AT, as in below image.

remove date from comments wordpress
Date and Time disappeared

8. To remove this word AT, just right-click on word AT and click Inspect. You can use any browser but for this tutorial, we are using Google Chrome.

9. Check the css class name for word AT. Please note that the css class name will vary based on your theme. In our case, it is comment-meta.

wordpress comments css class
comments css class

10. Add below code in your theme’s style.css (in the end). If you do not want to do changes in style.css then you can also go to Appearance and click on Customize.

datetime wordpress comments
Appearance Customize

11. There you can add below code.

.comment-meta { 
display:none; 
}

12. Save style.css and check your blog in browser. You will see that the word AT has also disappeared.

removing date wp comments
word AT disappeared

13. So, its upto you whether you add the above code directly in style.css or in Customize section.

Method Two – Using css class only

In the above method, we added some php code to get rid of commentaries times and then hide the extra word such as AT. Here, we are letting you know the way by which you can hide the full comment from appearing in your website.
1. As described in above screenshots, hover the mouse on date and click Inspect.

2. Check the css class and add below code (Make sure to replace the css class).

.comment-meta { 
display:none; 
}

Method Three – Removing Comments Code directly from WordPress Theme

The above method does not play with your theme’s existing code. But if you do not want to add extra lines of code and want to do modifications in the existing code itself then below method is for you. Make sure you take backup of your files before doing this.

1. Open comments.php and search for same class comment-meta. If you do not find this class in comments.php then try searching in other comments php files. We got this in comments-legacy.php. The filename will vary based on your theme.

2. Remove that code which is displaying date and time. For one of my sites, I removed below code and the date and time went away.

<small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a><?php edit_comment_link('e','',''); ?></small>

Method Four – Using a plugin

If you do not feel comfortable editing your blog’s themes or adding up any code then you can use Better Recent Comments WordPress plugin.

After you activate the plugin, just go to Appearance –> Widgets. You will see a widget bar for this plugin. Just drag and drop to any section on your blog and you are free to do customizations as per your choice. In below screenshot, we have unchecked “Show date”. You can also do the same.

better recent comments plugin
Better Recent Comments plugin

If you want to use the plugin functionality on any other part of your blog then you have to use the plugin’s inbuilt code system. You can try below code:

[better_recent_comments number="50" format="{avatar} {post} - {comment}"] 

CONCLUSION:
We have shown you four methods to get rid of timestamps from commentaries. We tried all methods and all worked for you. Now, its upto you that which one you prefer.

Leave a Comment

%d bloggers like this: