Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Remove Date and Time From WordPress Comments

Do you worry that old timestamps on comments make your content look outdated?

Even if you recently updated a post, a comment from five years ago might convince a visitor that the information is no longer relevant. This often stops new readers from joining the conversation.

At WPBeginner, we display comment dates to provide context for our tutorials. However, removing them is a popular strategy for sites that want to maintain a strictly evergreen appearance.

In this article, we will show you how to easily remove the date and time from WordPress comments.

Removing date and time from WordPress comments

🚨 Important Note: This article is only for removing date and time in WordPress comments. We do not recommend doing the same for your WordPress posts. For details, see our tutorial on why you should not remove dates from WordPress posts.

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 even a small error in the code can break your website.

That is why we recommend using WPCode. It is the best WordPress code snippets plugin on the market and the safest way to add custom code to your site.

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, hover your mouse over the ‘Add Your Custom Code (New Snippet)’ option and click the ‘Use Snippet’ button.

Add new snippet

On the next screen, you can type a name for your code snippet. This can be anything that helps you identify the code, like ‘Remove Comment Date’.

Next, choose the ‘PHP Snippet’ option from the code type dropdown menu in the right corner of the screen.

Choose PHP snippet to remove date and time in WordPress comments

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.

Choose auto insert mode

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.

Save snippet to remove date and time

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.

Preview for removing date and time in WordPress comments

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.

Displaying the author’s name helps build trust and transparency with your readers. However, removing the date and time can prevent your comments from looking outdated.

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.

Hiding the author name using custom code

For more details, see our tutorial on how to remove author names from WordPress posts.

Frequently Asked Questions About WordPress Comment Dates

Here are some of the most common questions our readers ask about removing date and time stamps from the comment section.

1. Does this code delete the dates from my WordPress database?

No, this code snippet does not delete any data from your WordPress database. It simply stops your WordPress theme from displaying the date and time on the front end of your website. If you remove the code snippet, the original dates and times will immediately reappear.

2. Can I use CSS to hide the comment date and time?

Yes, you can use CSS (specifically display: none;) to visually hide the date elements. However, we recommend the PHP method used in this guide because it prevents the date data from being processed and displayed by your theme.

3. Will removing comment dates hurt my SEO?

Removing comment dates generally does not hurt SEO. In fact, for evergreen content, it can improve user engagement by making the discussion feel active and relevant regardless of when the comments were posted. However, Google may still see the date in your site’s metadata.

4. Can I change the date format instead of removing it?

Yes. If you only want to remove the specific time or change how the date looks (for example, showing ‘July 2024’ instead of the full date), you can do this in your WordPress dashboard settings. For details, see our guide on how to change date and time format in WordPress.

Additional Resources

We hope this article helped you learn how to easily remove date and time from WordPress comments. You may also want to see some additional resources:

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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

25 CommentsLeave a Reply

  1. I like snippets for their simplicity and because I don’t necessarily have to use a plugin for everything. I even made a folder in the browser from your article with snippets. I also saved this one, because this function can come in handy at any time. Thank you for sharing these snippets so we can avoid another unnecessary plugin.

  2. I have a question relating to comments…is there a way to pin a reader’s comment in WordPress, similar to how YouTube allows pinned comments??

  3. I agree that removing the date may not be the best idea. The blog entries at some sites show “Updated over a week ago” in the date area. I think that Updated over a ago where the time period could be week, month, six moths, etc. could be interesting. All I need is to learn how to do it.

    • For specific edits like that, you would want to reach out to the support for your specific theme.

      Admin

  4. Awesome! Thanks for sharing. My first attempt to play with theme coding and it worked :) Your advice is much appreciated!

  5. Can you please recommend any good plugin to completely hide comments, date section from wordpress websites?

  6. 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.

    • 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.

      Admin

  7. 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.

      Admin

      • 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.

  8. 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.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.