#53678 closed defect (bug) (fixed)
Comment author filter is not applied to comment reply
Reported by: | mjulian7 | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.9 | Priority: | normal |
Severity: | minor | Version: | |
Component: | Comments | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
comment_form_title()
uses get_comment_author()
to display the comment author, however get_comment_reply_link()
uses $comment->comment_author
.
Therefore the latter does not apply the get_comment_author
filter.
Change History (9)
This ticket was mentioned in PR #1501 on WordPress/wordpress-develop by mjulian87.
3 years ago
#1
- Keywords has-patch added
This ticket was mentioned in PR #1501 on WordPress/wordpress-develop by mjulian87.
3 years ago
#2
Trac ticket: https://core.trac.wordpress.org/ticket/53678
get_comment_author
filters are applied in the output of the comment form, but not during the comment reply.
get_comment_author( $comment->comment_ID )
should be used instead of $comment->comment_author
inside get_comment_reply_link()
function.
#3
@
3 years ago
- Component changed from General to Comments
- Milestone changed from Awaiting Review to 5.9
#4
@
3 years ago
Patch looks good to me, I tested it applying this hook:
function wpcore_get_comment_author( $author, $comment_ID, $comment ) { return 'testing - ' . $author; } add_filter( 'get_comment_author', 'wpcore_get_comment_author', 10, 3 );
And it works fine on my side.
This ticket was mentioned in Slack in #core by chaion07. View the logs.
3 years ago
#6
@
3 years ago
- Keywords commit added
Hello @mjulian7! Thank you for reporting this. We discussed this ticket during a recent bug-scrub session for 5.9 and based on the feedback we're marking this for 'Commit'. Cheers!
Props: @audrasjb & @hellofromTonya
#7
@
3 years ago
Hi there, welcome to WordPress Trac! Thanks for the PR.
This looks good, but we should pass the full comment object to get_comment_author()
, instead of just the ID, same as other comment template functions do:
comment_author()
get_comment_author_link()
get_comment_text()
comment_form_title()
That way, it can reuse the existing object and avoid an creating a new WP_Comment
instance, with an extra cache lookup or database query. See [34039], [34042], [34129], and other similar changes on #33638 for more context.
#8
@
3 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 52154:
hellofromtonya commented on PR #1501:
3 years ago
#9
Committed in https://core.trac.wordpress.org/changeset/52154.
Trac ticket: https://core.trac.wordpress.org/ticket/53678
get_comment_author
filters are applied in the output of the comment form, but not during the comment reply.get_comment_author( $comment->comment_ID )
should be used instead of$comment->comment_author
insideget_comment_reply_link()
function.