Skip to content

Commit 126193f

Browse files
committed
Set the $comment global in comment_form_title().
In [33963], `comment_form_title()` was refactored so that it no longer made reference to the `$comment` global. This broke some functionality within the comment form, as certain template would no longer be able to access the "current" comment. Props d4z_c0nf, WisdmLabs, boonebgorges. Fixes #35624. git-svn-id: https://develop.svn.wordpress.org/trunk@36512 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 0ae22e5 commit 126193f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/wp-includes/comment-template.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,7 @@ function comment_id_fields( $id = 0 ) {
18171817
* to their comment. Default true.
18181818
*/
18191819
function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) {
1820-
$comment = get_comment();
1820+
global $comment;
18211821

18221822
if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' );
18231823
if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' );
@@ -1827,6 +1827,7 @@ function comment_form_title( $noreplytext = false, $replytext = false, $linktopa
18271827
if ( 0 == $replytoid )
18281828
echo $noreplytext;
18291829
else {
1830+
// Sets the global so that template tags can be used in the comment form.
18301831
$comment = get_comment($replytoid);
18311832
$author = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author( $comment ) . '</a>' : get_comment_author( $comment );
18321833
printf( $replytext, $author );

0 commit comments

Comments
 (0)