Comment Author Profile

  • Rand0m_Hero


    Is it possible to link the comment author display name to user profile rather than his/her website url, as it is right now?



    May I request help from anyone who can.


    Syahir Hakim


    Hi bala,

    In your child theme’s functions.php file, insert this code:

    * This function replaces the comment author's link with the comment author's profile page,
    * if the comment author is a registered user. Otherwise, the standard WordPress comment
    * author link is displayed
    function graphene_comment_author_profile_link(){

    /* Get the comment author information */
    global $comment;
    $comment_ID = $comment->user_id;
    $author = get_comment_author( $comment_ID );
    $url = get_comment_author_url( $comment_ID );

    /* Return the default WordPress comment author link if comment author is not
    a registered user */
    if ($comment_ID == 0){
    if ( empty( $url ) || 'http://' == $url )
    $return = $author;
    $return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
    } else {
    /* Return the link to the comment author's profile age if otherwise */
    $return = '<a href="'.home_url().'/?author='.$comment_ID.'">'.$author.'</a>';

    return $return;
    add_filter('get_comment_author_link', 'graphene_comment_author_profile_link');

    Took some figuring out to achieve that 🙂



    Syahir, pls respond to my problem thanks 🙁

    Here the link for my problem



    Thanks a lot for your help, persistence and valuable time. Just a question:

    Do I need to o anything to the already existing lines of code(# 508 & 509)in “functions.pp”?

    <cite><?php comment_author_link(); ?></cite><?php _e(‘ says:’,’graphene’); ?>

    <?php do_action(‘graphene_comment_author’); ?>

    And do I need to change/remove anything else? Thanks & regards.


    Syahir Hakim


    Are you using a child theme? If yes, the code above should be placed in the child theme’s functions.php file, not the original theme’s functions.php file. This will ensure that the modification will not be lost the next time you update the theme.

    If you haven’t yet implemented a child theme, see how to do so here:



    Why anyone don’t want answer for my question?



    Yes, I have created a folder “graphene_modified” under “themes”, copied original “graphene” ( v 1.2) theme files into this folder & then modified them (both .css & .php). And I have copied the code snippet given by you (thanks gain) in “functions.php” in this folder. Now, do I need to delete the original 2 lines already existing:

    <cite><?php comment_author_link(); ?></cite><?php _e(' says:','graphene'); ?>
    <?php do_action('graphene_comment_author'); ?>

    OR leave them alone? Thanks, in anticipation of your reply.


    Syahir Hakim


    Bala, you are not doing it right. There is no need to copy any of the theme’s files at all. Make sure you read properly on how to set up a child theme:

Viewing 9 posts - 1 through 9 (of 9 total)

  • You must be logged in to reply to this topic.