[wp-trac] [WordPress Trac] #63263: check if exists before accessing object properties of $post->comment_count

WordPress Trac noreply at wordpress.org
Sun Apr 13 14:41:26 UTC 2025


#63263: check if exists before accessing object properties of $post->comment_count
--------------------------+------------------------------
 Reporter:  Presskopp     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Feeds         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by Presskopp):

 FYI: there's a function {{{get_comments_number( $post = 0 )}}}, which
 could be helpful here. Also there are more instances of
 {{{$post->comment_count}}} in 3 more core files.

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


More information about the wp-trac mailing list