Do you want to remove dates from the WordPress comments area on your website? Recently bloggers have been wanting to remove comment dates to make their comments look fresh and evergreen. In this article, we will show you how to remove dates from WordPress comments.
Should you Remove Date from WordPress Comments?
Some users believe that hiding date and time in WordPress will prevent their articles from looking dated thus improving their improve WordPress SEO and search engine rankings.
We disagree with this sentiment. In fact, we believe removing dates can be quite problematic.
You can see our article on why you should not remove dates from WordPress posts for more details.
Same arguments are true for your WordPress comments as well. Removing date and time from comments will hide important information which would make older comments look odd.
However, we understand that some users may be using comments differently than normal web comments. For example, on a WordPress intranet or a web application.
In that case, they may need to remove date or time from WordPress comments to meet their requirements.
That being said, let’s take a look at how to easily remove date and time from WordPress comments.
Removing Date and Time from WordPress Comments
This tutorial requires you to edit your WordPress theme files. If you haven’t done this before, then please take a look at our guide on how to copy and paste code in WordPress.
First you need to add the following code in your theme’s functions.php file or in a site-specific plugin.
// Remove comment date function wpb_remove_comment_date($date, $d, $comment) { if ( !is_admin() ) { return; } else { return $date; } } add_filter( 'get_comment_date', 'wpb_remove_comment_date', 10, 3); // Remove comment time function wpb_remove_comment_time($date, $d, $comment) { if ( !is_admin() ) { return; } else { return $date; } } add_filter( 'get_comment_time', 'wpb_remove_comment_time', 10, 3);
You can now visit any post with comments on your website, and you will see the date and time are no longer visible.
However, you may also find preposition words like ‘at’ or ‘posted on’ left behind.
To remove them, you need to point the cursor to those words and right-click to select ‘Inspect’ from the browser menu.
Next, you need to note the CSS class used in the surrounding div
or span
around date/time in your theme.
After that you need to add the following custom CSS to your theme to hide this information:
.comment-time { display:none; }
You can now save your changes and visit your website to see it in action.
That’s all you have successfully removed date and time from WordPress comments.
Please note that this method does not remove comment dates and time from your WordPress database. Removing the code will immediately start displaying date and time for WordPress comments on your site.
We hope this article helped you learn how to easily remove date and time from WordPress comments. You may also want to see our list of the must have WordPress plugins for business websites.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Awesome! Thanks for sharing. My first attempt to play with theme coding and it worked
Your advice is much appreciated!
You’re welcome, glad our guide could help
Can you please recommend any good plugin to completely hide comments, date section from wordpress websites?
If you want to completely remove the comments, you would want to take a look at the article here: https://www.wpbeginner.com/wp-tutorials/how-to-completely-disable-comments-in-wordpress/
Works like a charm! Thank you
Glad our article was helpful
Thanks again, it worked like a charm on the website. It goes to show even for people who are not that familiar with coding can accomplish these tasks with the help of WPBEGINNER.
You’re welcome, glad our guide could help
Thanks for the solution.
How to remove blank space create after remove date and time ??
Thanks
That would require editing your theme’s CSS which is different for each theme. If you reach out to your theme’s support they should be able to assist.
Hi,
I tried to use the php code above and it worked
But, how to use php code to remove ‘at’?
I used the css code above, but that would be a hidden text. When I viewed the source code, ‘at’ was still there.
How to use php code to remove ‘at’?
Thanks
For that, you would normally want to reach out to your theme’s support and create a child theme to edit the comment template rather than use PHP.
Date and time got removed but i can see the link on at. I am applying the css u mentioned but its not working
Your specific theme likely may have different stylings for your comments, if you reach out to your theme’s support they should be able to let you know.
I truly hate every website that removes dates so its content seems to be everlasting. It’s misleading and we can’t tell if something is outdated or not.
Sorry, I can’t agree with you.