钩子文档

get_comment_time

💡 云策文档标注

概述

get_comment_time 是一个 WordPress 过滤器钩子,用于修改返回的评论时间。它允许开发者自定义评论时间的格式、时区、翻译和基于评论对象进行处理。

关键要点

  • 过滤器名称:get_comment_time
  • 参数:$comment_timestring|int(评论时间,可以是日期字符串或 Unix 时间戳)、$format(PHP 日期格式)、$gmt(是否使用 GMT 时间)、$translate(是否翻译时间)、$comment(WP_Comment 对象)
  • 源调用:apply_filters('get_comment_time', $comment_time, $format, $gmt, $translate, $comment)
  • 相关函数:get_comment_time() 用于获取当前评论的时间
  • 引入版本:WordPress 1.5.0

📄 原文内容

Filters the returned comment time.

Parameters

$comment_timestring|int
The comment time, formatted as a date string or Unix timestamp.
$formatstring
PHP date format.
$gmtbool
Whether the GMT date is in use.
$translatebool
Whether the time is translated.
$commentWP_Comment
The comment object.

Source

return apply_filters( 'get_comment_time', $comment_time, $format, $gmt, $translate, $comment );

Changelog

Version Description
1.5.0 Introduced.