[wp-trac] [WordPress Trac] #52322: Add comment / comment id param to get_comment_time

WordPress Trac noreply at wordpress.org
Tue Jan 24 11:29:47 UTC 2023


#52322: Add comment / comment id param to get_comment_time
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:  audrasjb
     Type:  enhancement                          |      Status:  reviewing
 Priority:  normal                               |   Milestone:  6.2
Component:  Comments                             |     Version:  1.5
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug has-patch changes-    |     Focuses:
  requested                                      |
-------------------------------------------------+-------------------------

Comment (by spacedmonkey):

 There needs to be a check to see if the comment exists.

 {{{#!php
  $comment = get_comment( $comment_ID );
 }}}

 A check like this

 {{{#!php
 $comment = get_comment( $comment_id );

         if ( ! $comment ) {
            return '';
         }
 }}}

 We may even need to do this

 {{{#!php
 if ( !$comment || 'trash' === get_post_status( $comment->comment_post_ID )
 ) {
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52322#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list