
删除 WordPress
您想从您网站上的 WordPress 评论区域中删除日期吗?最近,博主一直希望删除评论日期,以使他们的评论看起来新鲜且常青。在本文中,我们将向您展示如何从 WordPress 评论中删除日期。
您想从您网站上的 WordPress 评论区域中删除日期吗?最近,博主一直在寻求删除评论日期,以使他们的评论看起来新鲜且常青。在本文中,我们将向您展示如何从 WordPress 评论中删除日期。

您应该从WordPress评论中删除日期吗? (Should you Remove Date from WordPress Comments?)
Some users believe that hiding WordPress 中的日期和时间 will prevent their articles from looking dated thus improving their 提高 WordPress 搜索引擎优化 and search engine rankings.
一些用户认为, 在 WordPress 中中隐藏日期和时间将阻止其文章过时,从而改善了他们的WordPress 搜索引擎优化和搜索引擎排名。
我们不同意这种观点。事实上,我们认为删除日期可能会带来很大的问题。
我们不同意。事实上,我们认为删除日期可能会带来很大问题。
You can see our article on why you 不应从 WordPress 帖子中删除日期 for more details.
您可以查看有关为何不带日期的文章应从 WordPress 帖子中删除,以了解更多详细信息。
同样的论点也适用于您的 WordPress 评论。从评论中删除日期和时间将隐藏重要信息,这会使旧评论看起来很奇怪。
同样的论点也适用于您的 WordPress 评论。从评论中删除日期和时间将隐藏重要信息,这可能会使旧评论看起来很奇怪。
However, we understand that some users may be using comments differently than normal web comments. For example, on a WordPress 内联网 or a web application.
但是,我们了解到某些用户使用的评论可能与普通的网络评论不同。 例如,在WordPress 内联网或Web应用程序上。
在这种情况下,他们可能需要从 WordPress 评论中删除日期或时间以满足他们的要求。
在这种情况下,他们可能需要从 WordPress 评论中删除日期或时间以满足他们的要求。
话虽这么说,让我们看看如何轻松地从 WordPress 评论中删除日期和时间。
话虽如此,让我们看看如何轻松地从 WordPress 评论中删除日期和时间。
从WordPress注释中删除日期和时间 (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 在 WordPress 中复制并粘贴代码.
本教程要求您编辑WordPress主题文件。 如果您以前没有做过,请查看我们的指南,了解如何在 WordPress 中复制并粘贴代码 。
First you need to add the following code in your theme’s 函数.php file or in a 特定于站点的插件.
首先,您需要在主题的函数.php文件或具体的于在网站的插件中添加以下代码。
// 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);
您现在可以访问网站上的任何带有评论的帖子,并且您将看到日期和时间不再可见。
现在,您可以访问网站上的任何带有评论的帖子,您将看到日期和时间不再可见。

However, you may also find preposition words like '在' or '发表于' left behind.
但是,您可能还会发现诸如“在”或“发表于”类的介词。
要删除它们,您需要将光标指向这些单词,然后右键单击以从浏览器菜单中选择“检查”。
要删除它们,您需要将光标指向这些单词并右键单击以从浏览器菜单中选择“检查”。

Next, you need to note the CSS class used in the surrounding div
or span
around date/time in your theme.
接下来,你需要注意周围使用CSS类div
或span
在你的主题围绕的日期/时间。
After that you need to add the following 自定义CSS to your theme to hide this information:
之后,您需要将以下自定义CSS添加到主题中以隐藏此信息:
.comment-time {
display:none;
}
您现在可以保存更改并访问您的网站以查看其实际效果。
现在您可以保存更改并访问您的网站以查看它们的实际效果。

这就是您成功从 WordPress 评论中删除日期和时间的全部内容。
这就是成功从 WordPress 评论中删除日期和时间所需的全部内容。
Please note that this method does not remove comment dates and time from your WordPress 数据库. Removing the code will immediately start displaying date and time for WordPress comments on your site.
请注意,此方法不会从WordPress 数据库删除评论日期和时间。 删除代码将立即开始在您的站点上显示WordPress注释的日期和时间。
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 必须有 WordPress 插件 for business websites.
我们希望本文能帮助您学习如何轻松地从WordPress评论中删除日期和时间。 您可能还想查看我们的一定有用于商务网站的WordPress 插件列表。
If you liked this article, then please subscribe to our YouTube 频道 for WordPress video tutorials. You can also find us on 推特 and Facebook.
如果您喜欢这篇文章,请订阅我们的YouTube 频道 WordPress视频教程。 您也可以在推特和Facebook上找到我们。
翻译自: https://www.wpbeginner.com/wp-themes/how-to-remove-date-and-time-from-wordpress-comments/
删除 WordPress