Skip to content

Commit 85cd4a1

Browse files
Comments: Allow to pass $comment_ID parameter to comment_time().
This brings consistency with: * `get_comment_time()` * `get_comment_date()` * `comment_date()` Includes: * Correcting the `@since` tag for `get_comment_time()`. * Synchronizing parameter description between `get_comment_date()` and `get_comment_time()`. Follow-up to [55284]. See #52322. git-svn-id: https://develop.svn.wordpress.org/trunk@55287 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 6ae5afc commit 85cd4a1

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/wp-includes/comment-template.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ function get_comment_class( $css_class = '', $comment_id = null, $post = null )
547547
* @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
548548
*
549549
* @param string $format Optional. PHP date format. Defaults to the 'date_format' option.
550-
* @param int|WP_Comment $comment_ID WP_Comment or ID of the comment for which to get the date.
550+
* @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the date.
551551
* Default current comment.
552552
* @return string The comment's date.
553553
*/
@@ -1031,14 +1031,14 @@ function comment_text( $comment_ID = 0, $args = array() ) {
10311031
* Retrieves the comment time of the current comment.
10321032
*
10331033
* @since 1.5.0
1034-
* @since 6.2.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
1034+
* @since 6.2.0 Added the `$comment_ID` parameter.
10351035
*
10361036
* @param string $format Optional. PHP date format. Defaults to the 'time_format' option.
10371037
* @param bool $gmt Optional. Whether to use the GMT date. Default false.
10381038
* @param bool $translate Optional. Whether to translate the time (for use in feeds).
10391039
* Default true.
1040-
* @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the date.
1041-
* Default is 0, or the global comment.
1040+
* @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the time.
1041+
* Default current comment.
10421042
* @return string The formatted time.
10431043
*/
10441044
function get_comment_time( $format = '', $gmt = false, $translate = true, $comment_ID = 0 ) {
@@ -1072,11 +1072,14 @@ function get_comment_time( $format = '', $gmt = false, $translate = true, $comme
10721072
* Displays the comment time of the current comment.
10731073
*
10741074
* @since 0.71
1075+
* @since 6.2.0 Added the `$comment_ID` parameter.
10751076
*
1076-
* @param string $format Optional. PHP time format. Defaults to the 'time_format' option.
1077+
* @param string $format Optional. PHP time format. Defaults to the 'time_format' option.
1078+
* @param int|WP_Comment $comment_ID Optional. WP_Comment or ID of the comment for which to get the time.
1079+
* Default current comment.
10771080
*/
1078-
function comment_time( $format = '' ) {
1079-
echo get_comment_time( $format );
1081+
function comment_time( $format = '', $comment_ID = 0 ) {
1082+
echo get_comment_time( $format, $comment_ID );
10801083
}
10811084

10821085
/**

0 commit comments

Comments
 (0)