How to Remove Dates From WordPress Comments

remove dates

Are you trying to remove dates from WordPress site of yours? Nowadays, there are several reasons that bloggers want to remove comment dates. One reason is to look at their comments as fresh and evergreen. If you want this feature in your blog, then this post is just for you. 

In this post, I will show you how to remove dates from WordPress comments.

Let’s begin, then. 

Remove Dates From WordPress Comments

Before you start, it is recommended to take a backup of your website before you edit code. You can always restore your website to an earlier stage at any time from the backup. If you don’t know how to take a backup, you can see this post’ How to Take a Backup of WordPress Website(Easiest Method)‘.

To remove dates from WordPress comments, at first navigate to Appearance -> Theme Editor and select functions.php

Now paste the following code. 

// 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);

Don’t forget to hit the ‘update file’ button. Now visit any post on your website, and you will see that there is no date and time visible in the comments. 

However, you may find that prepositions like ‘on’ or ‘at’ are visible in the post. To remove those, right-click on the preposition and select ‘inspect’. 

Now note the CSS class in the div or span around the date/time in your theme. Then add the following CSS code to your theme, to hide those prepositions. 

.comment-time { 
display:none; 
}

Note: here, ‘.comment-time’ is the class that I found in my theme; you may find any different class. 

Now click on Save Changes and visit your website. You will find changes. 

Last Words

Hope you have successfully removed dates from your comments. But remember this, this method doesn’t eradicate dates completely from the WordPress database. If you delete the code, the dates will be visible immediately. If you liked this post, you can see other posts on our blog, and you might like those too. 

Please share the post with your friends and leave your thoughts in the comment box below. 

Was this helpful?

Thanks for your feedback!

One response to “How to Remove Dates From WordPress Comments”

  1. Na temat Avatar
    Na temat

    As for the dates, it seems to me that it’s good to set or a visible date of updating the page, not publication. Or remove the date altogether if you’re writing about things that don’t get old. Like a recipe for a cake, planting carrots, etc. Google knows perfectly well when a given entry came to it for the first time.

Leave a Reply

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

Introducing New Table Block Plugin - Tableberg

X
Need help?