Make WordPress Core


Ignore:
Timestamp:
02/07/2023 06:24:02 PM (17 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r55284 r55287  
    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.
     
    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.
     
    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 */
     
    10731073 *
    10741074 * @since 0.71
    1075  *
    1076  * @param string $format Optional. PHP time format. Defaults to the 'time_format' option.
    1077  */
    1078 function comment_time( $format = '' ) {
    1079     echo get_comment_time( $format );
     1075 * @since 6.2.0 Added the `$comment_ID` parameter.
     1076 *
     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.
     1080 */
     1081function comment_time( $format = '', $comment_ID = 0 ) {
     1082    echo get_comment_time( $format, $comment_ID );
    10801083}
    10811084
Note: See TracChangeset for help on using the changeset viewer.