• Resolved mrfogel93

    (@mrfogel93)


    Hello,

    Ive using using the hestia theme for a while now. Im pretty impressed so far.
    I want to change the displayed comments author name, somehow this is always the full name of the user. I couldnt find settings for that so i tried to add a filter in my functions.php of my child-theme:

    add_filter('get_comment_author', 'my_comment_author', 10, 2);
    
    function my_comment_author( $author = '' ) {
        // Get the comment ID from WP_Query
    
        $comment = get_comment( $comment_ID );
    
    	if (!empty($comment->user_id)){
    		$user=get_userdata($comment->user_id);
    		$author=$user->display_name; // this is the actual line you want to change
    	} else {
    		$author = __('Anonymous');
    	}
    
        return $author;
    };

    But even if I just return some string, the displayed comment author name wont change.

    Best regards
    Simon

    The page I need help with: [log in to see the link]

  • The topic ‘Change the comment author name on hestia’ is closed to new replies.