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

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Do you want to remove the date and time from WordPress comments on your website?

Recently, many 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 easily remove the date and time from WordPress comments.

Removing date and time from WordPress comments

Should You Remove the Date and Time From WordPress Comments?

Some users believe that hiding the date and time in WordPress will prevent their articles from looking dated, improving their WordPress SEO and search engine rankings.

However, we disagree with this sentiment. In fact, we believe removing dates can be quite problematic.

For more details, you can see our article on why you should not remove dates from WordPress posts.

The same arguments are true for your WordPress comments as well. Removing the 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 the date or time from comments on your WordPress website to meet their requirements.

That being said, let’s take a 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.

It is the best WordPress code snippets plugin on the market that makes it super safe and easy to add custom code.

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.

Add new snippet

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.

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

Apart from removing the date and time from comments, you can also remove the author’s name from the 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.

Hiding the author name using custom code

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

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.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

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

21 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Roger M. Jenson says

    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.

    • WPBeginner Support says

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

      Admin

  3. Ivan says

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

  4. Ahmad Wali says

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

  5. Luke Thomas says

    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.

  6. Sahil Sharma says

    Thanks for the solution.

    How to remove blank space create after remove date and time ??

    Thanks

    • WPBeginner Support says

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

    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

    • WPBeginner Support says

      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

      • Saarika says

        Date and time got removed but i can see the link on at. I am applying the css u mentioned but its not working

        • WPBeginner Support says

          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. Angel Costa says

    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 to Luke Thomas Cancel 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.

WPBeginner Assistant
How can I help you?

By chatting, you consent to this chat being stored according to our privacy policy and your email will be added to receive weekly WordPress tutorials from WPBeginner.