Removing the date and time from WordPress comments can help keep your site looking tidy.
Adjusting comment settings improves your site’s aesthetics and boosts engagement by highlighting the content of the comments themselves.
At WPBeginner, we encourage engagement on our blog by asking readers to leave a comment at the end of each article. If you check out our comment section, you will notice that we don’t display the time or date when a comment was published.
This helps keep the comment section looking fresh and makes our content feel more relevant.
In this article, we will show you how to easily remove the date and time from WordPress comments. Our instructions are based on tried and tested methods, ensuring an easy and effective implementation.
Why Remove the Date and Time From WordPress Comments?
When readers see older comments with dates from months or years ago, they might assume the article is outdated, even if the information is still relevant.
Some users believe that hiding the date and time for their comments will prevent their articles from looking dated, improving their search engine rankings.
By hiding the date, the focus stays on the content and the discussion rather than the age of the comments, which helps you maintain a fresh and active appearance.
Removing dates and times can also help your site if it has low comment activity. If visitors notice that the most recent comment was published a long time ago, they might hesitate to engage, assuming that your site is not active.
By removing these timestamps, you eliminate any potential hesitation and create a more welcoming environment for discussion.
However, keep in mind that removing dates from comments can also have some potential drawbacks, as it can create confusion for users.
Some readers prefer to know when a comment was made to better understand the context of the discussion, especially for content that changes over time, such as tutorials, reviews, or guides.
Without timestamps, readers may have difficulty understanding whether a comment is still relevant to their situation.
That said, let’s look at how to easily remove the date and time from WordPress comments.
How to Remove the Date and Time From WordPress Comments
You can easily remove the date and time from WordPress comments by adding custom code to your theme’s functions.php file.
However, keep in mind that the smallest error while typing the code can make your website inaccessible.
We recommend using WPCode instead to add custom code to your WordPress site because it is the best WordPress code snippets plugin on the market
During our evaluation, we found it to be the easiest and safest way to add custom code. To learn more, see our WPCode review.
First, you need to install and activate the WPCode plugin. For detailed instructions, you may want to see our beginner’s guide on how to install a WordPress plugin.
Note: WPCode also has a free version that you can use for this tutorial. However, upgrading to the paid plan will give you access to the cloud library of code snippets, conditional logic, and more.
Upon activation, visit the Code Snippets » + Add Snippet page from the WordPress admin sidebar.
From here, you must click the ‘Use Snippet’ button under the ‘Add Your Custom Code (New Snippet)’ option.
This will direct you to the ‘Create Custom Snippet’ page, where you can start by typing a name for the code snippet.
Next, choose the ‘PHP Snippet’ option from the code type dropdown menu in the right corner of the screen.
After that, simply copy and paste the following code into the ‘Code Preview’ box:
// 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);
After that, scroll down to the ‘Insertion’ section and choose the ‘Auto Insert’ mode.
This will automatically execute the code on your site.
Next, scroll back to the top of the page and toggle the switch to ‘Active’.
Finally, click the ‘Save Snippet’ button to store your settings.
Now, you can visit your website to see the date and time removed from your WordPress comments.
Please note that this method does not remove comment dates and times from your WordPress database.
Removing the code will immediately start displaying the date and time for WordPress comments on your site.
Bonus: Remove Author Name From WordPress Posts
You can remove the date and time from comments and the author’s name from posts on your WordPress blog.
Usually, adding an author’s name to the blog posts gives additional information to users and may increase engagement.
However, if you run a multi-author blog or manage guest bloggers, then removing the author’s name can make your site look more consistent.
You can easily do this by adding a CSS code snippet to your website with WPCode.
For more details, see our tutorial on how to remove author names from WordPress posts.
We hope this article helped you learn how to easily remove date and time from WordPress comments. You may also want to see our tutorial on how to add a dynamic copyright date in the WordPress footer and our list of the best WordPress database plugins for 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.