检索当前评论的评论日期。
原型
get_comment_date( string $d = '', int|WP_Comment $comment_ID )
参数
$d
(string)
(Optional)
日期的格式。默认用户的设置。
$comment_ID
(int|WP_Comment)
(Optional)
要获取日期的评论的WP_Comment或ID。默认当前评论。
返回值
(string)
评论的日期。
源文件
路径:wp-includes/comment-template.php
<?php
...
function get_comment_date( $d = '', $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
if ( '' == $d )
$date = mysql2date(get_option('date_format'), $comment->comment_date);
else
$date = mysql2date($d, $comment->comment_date);
/**
* Filters the returned comment date.
*
* @since 1.5.0
*
* @param string|int $date Formatted date string or Unix timestamp.
* @param string $d The format of the date.
* @param WP_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_date', $date, $d, $comment );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_comment_date/