Removing Date and Time from WordPress Comments

wordpress comments dates removal

Is removing the date from WordPress comments your goal? Recently, bloggers have always wanted to delete the comment date to make their comments look fresh and evergreen. This article will show how to remove dates from WordPress comments.

Should dates be removed from WordPress comments?

Some users believe that hiding the date and time in WordPress will prevent their articles from looking outdated, thereby improving their ranking of WordPress SEO and search engines. It is best to disagree with this view. In fact, there may be a big problem with deleting dates. The same is true for WordPress comments. Removing the date and time from comments will hide important information, which will make older comments look strange. However, it is understandable that some users may use comments that are different from normal online comments. For example, on WordPress Intranet or web application. In this case, they may need to remove the date or time from the WordPress comments to meet their requirements. Having said that, let’s see how to easily remove the date and time from WordPress comment.

Remove date and time from WordPress comment

First, add the following code in the theme’s functions.php file or 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);

Now access any post commented on your website, the date and time will no longer be visible.

 

WordPress Comments with"at"

However, it is possible to find “at” or “post on” on the preposition. To delete them, point your cursor at these words and right-click to select “Check” from the browser menu.

CSS property of comments

Next, write down the CSS class used for the date/time around the div or span in the theme. After that, add the following custom CSS to the theme to hide this information:

.comment-time {

display: none;

}

Now save changes and visit the website to see its operation.

WordPress comments with no time/date

As shown in the image above the date and time from WordPress, comments has been successfully deleted. Please note that this method does not delete the date and time of the annotation from the WordPress database. Deleting the code will immediately start displaying the date and time of WordPress comment on the website.

Hope this article helped you understand how to easily remove dates and times from WordPress Comments.

You May Also Like

About the Author: BW

Leave a Reply

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