WordPress.org

Make WordPress Core

Opened 6 weeks ago

Last modified 5 weeks ago

#47174 accepted defect (bug)

Comment reply links are always to first comment form on a page when $withcomments variable is set to true

Reported by: johnh10 Owned by: peterwilsoncc
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.1
Component: Comments Keywords: needs-testing has-patch
Focuses: Cc:

Description

This is a follow-up to #33383.

This bug has returned. I'm not sure which version re-introduced this, but the original fix for #33383 (get_permalink) is missing in the current comments-template.php

The WordPress v5.2 code starting at line 1695 of comments-template.php should be:

<?php
                $link = sprintf(
                        "<a rel='nofollow' class='comment-reply-link' href='%s' %s aria-label='%s'>%s</a>",
                        esc_url(
                                add_query_arg(
                                        array(
                                                'replytocom'      => $comment->comment_ID,
                                                'unapproved'      => false,
                                                'moderation-hash' => false,
                                        ),
                                        get_permalink($post->ID)
                                )
                        ) . '#' . $args['respond_id'],
                        $data_attribute_string,
                        esc_attr( sprintf( $args['reply_to_text'], $comment->comment_author ) ),
                        $args['reply_text']
                );

After adding the get_permalink line it works as expected.

Attachments (1)

47174.diff (491 bytes) - added by justinahinon 6 weeks ago.

Download all attachments as: .zip

Change History (4)

#1 @justinahinon
6 weeks ago

  • Keywords needs-patch needs-testing added
  • Version set to 5.2

Hi @johnh10
Just created a patch for this. I'll track the previous versions changesets to find out where the last one has been removed.

@justinahinon
6 weeks ago

#2 @earnjam
5 weeks ago

  • Keywords has-patch added; needs-patch removed
  • Version changed from 5.2 to 5.1

Looks like that get_permalink() arg was removed in [42360], so I think this came back in 5.1.

#3 @peterwilsoncc
5 weeks ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to peterwilsoncc
  • Status changed from new to accepted
Note: See TracTickets for help on using tickets.