How to Remove Date and Time from WordPress Comments

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!

Pin It on Pinterest

Add address