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

How To Remove Dates From WordPress Comments

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 date/time in your theme. Then add the following CSS code on your theme, to hide those prepositions. 

.comment-time { 
display:none; 
}

Note: at here ‘.comment-time’ is the clss 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 e 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. 

close

Easy WP Tweaks

10X Your Site Growth!

Join the growing library of Easy WP Tweaks to grow your WordPress site.

Leave a Comment

Copy link
Powered by Social Snap