Parent comment's author name

admin2025-06-02  0

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 badges
Add a comment  | 

1 Answer 1

Reset to default 4

In 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 );
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748828316a314060.html

最新回复(0)