Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#21184 closed defect (bug) (fixed)

$comment global var is not set when wp_list_comments is called with callback function

Reported by: sirzooro Owned by: ryan
Milestone: 3.5 Priority: normal
Severity: normal Version: 2.7
Component: Comments Keywords: has-patch
Focuses: Cc:


Many comments-related functions (mainly template ones) uses comment object stored in global variable $comment, when they are called without parameters. However when you try to use wp_list_comments() with custom callback function, this is not true. Currently template authors have to either set this global var in their callback functions, or explicitly pass comment object to functions like comment_text(). Attached path fixes this.

Attachments (1)

comment-template.php.diff (555 bytes) - added by sirzooro 7 years ago.

Download all attachments as: .zip

Change History (3)

#1 @SergeyBiryukov
7 years ago

  • Milestone changed from Awaiting Review to 3.5

#2 @ryan
7 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In [21324]:

Set the global comment var before invoking callbacks in wp_list_comments(). Props sirzooro. fixes #21184

Note: See TracTickets for help on using tickets.