I was really suprised when I couldn't find WP functionality to display the person's name who was replied to.. Any way around this problem? How do I get the name of parent comment's author?
I was really suprised when I couldn't find WP functionality to display the person's name who was replied to.. Any way around this problem? How do I get the name of parent comment's author?
Share Improve this question asked Feb 25, 2016 at 10:13 N00bN00b 2,1794 gold badges22 silver badges32 bronze badges1 Answer
Reset to default 4In your comment callback, you could get that info with the help of the comment_parent
property of the current $comment
object.
We can then use the comment_author()
function to display the comment author's name:
// Display the parent comment author's name:
if( $comment->comment_parent )
comment_author( $comment->comment_parent );
and the comment_author_link()
function to display the comment author's link:
// Display the parent comment author's link:
if( $comment->comment_parent )
comment_author_link( $comment->comment_parent );