diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php
index 63614663de..239a75936a 100644
|
a
|
b
|
function comment_text( $comment_ID = 0, $args = array() ) { |
| 1030 | 1030 | * Retrieves the comment time of the current comment. |
| 1031 | 1031 | * |
| 1032 | 1032 | * @since 1.5.0 |
| | 1033 | * @since 6.2.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
| 1033 | 1034 | * |
| 1034 | 1035 | * @param string $format Optional. PHP time format. Defaults to the 'time_format' option. |
| 1035 | 1036 | * @param bool $gmt Optional. Whether to use the GMT date. Default false. |
| 1036 | 1037 | * @param bool $translate Optional. Whether to translate the time (for use in feeds). |
| 1037 | 1038 | * Default true. |
| | 1039 | * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the date. |
| 1038 | 1040 | * @return string The formatted time. |
| 1039 | 1041 | */ |
| 1040 | | function get_comment_time( $format = '', $gmt = false, $translate = true ) { |
| 1041 | | $comment = get_comment(); |
| | 1042 | function get_comment_time( $format = '', $gmt = false, $translate = true, $comment_ID = 0 ) { |
| | 1043 | $comment = get_comment( $comment_ID ); |
| 1042 | 1044 | |
| 1043 | 1045 | $comment_date = $gmt ? $comment->comment_date_gmt : $comment->comment_date; |
| 1044 | 1046 | |
| … |
… |
function get_comment_time( $format = '', $gmt = false, $translate = true ) { |
| 1050 | 1052 | * Filters the returned comment time. |
| 1051 | 1053 | * |
| 1052 | 1054 | * @since 1.5.0 |
| | 1055 | * @since 6.2.0 Added `$comment_ID` so that developer can get a direct comment id |
| 1053 | 1056 | * |
| 1054 | 1057 | * @param string|int $date The comment time, formatted as a date string or Unix timestamp. |
| 1055 | 1058 | * @param string $format PHP date format. |
| 1056 | 1059 | * @param bool $gmt Whether the GMT date is in use. |
| 1057 | 1060 | * @param bool $translate Whether the time is translated. |
| 1058 | 1061 | * @param WP_Comment $comment The comment object. |
| | 1062 | * @param string $comment_ID The comment ID as a numeric string. |
| 1059 | 1063 | */ |
| 1060 | | return apply_filters( 'get_comment_time', $date, $format, $gmt, $translate, $comment ); |
| | 1064 | return apply_filters( 'get_comment_time', $date, $format, $gmt, $translate, $comment, $comment_ID ); |
| 1061 | 1065 | } |
| 1062 | 1066 | |
| 1063 | 1067 | /** |
| 1064 | 1068 | * Displays the comment time of the current comment. |
| 1065 | 1069 | * |
| 1066 | 1070 | * @since 0.71 |
| | 1071 | * @since 6.2.0 Added the ability for `$comment_ID` to also accept a WP_Comment object. |
| 1067 | 1072 | * |
| 1068 | 1073 | * @param string $format Optional. PHP time format. Defaults to the 'time_format' option. |
| | 1074 | * @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the date. |
| 1069 | 1075 | */ |
| 1070 | | function comment_time( $format = '' ) { |
| 1071 | | echo get_comment_time( $format ); |
| | 1076 | function comment_time( $format = '', $comment_ID = 0 ) { |
| | 1077 | echo get_comment_time( $format, false, true, $comment_ID ); |
| 1072 | 1078 | } |
| 1073 | 1079 | |
| 1074 | 1080 | /** |