Opened 6 years ago
Closed 5 years ago
#47174 closed defect (bug) (fixed)
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: | has-patch has-unit-tests |
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 (3)
Change History (10)
#2
@
6 years 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
@
6 years ago
- Milestone changed from Awaiting Review to 5.3
- Owner set to peterwilsoncc
- Status changed from new to accepted
#4
@
5 years ago
- Keywords needs-testing removed
I added unit test in my patch - 47174.2.diff.
Seeing that this issue "resurfaced", a unit test would be beneficially to prevent this from happening again.
#5
@
5 years ago
- Keywords has-unit-tests added
Thanks @donmhico, you read my mind!
47174.3.diff is almost identical to version 2 with the following changes:
- some coding standards fixes
- renamed a couple of variables for clarity to indicate they contain IDs rather than objects
Note: See
TracTickets for help on using
tickets.
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.