• Hi all,

    I have already renamed the URL/Website field in the standard comments form to something more relevant to my site…however now when the comment author is shown in the recent comments widget, it is still as a hyperlink – either to ‘https://’ or to a nonsensical address whereby the field input is tacked on to the end of the https:// thus making something like ‘https://eggs’ etc.

    How can I remove the hyperlink from the comment author and just have the author displayed as plain text?

    Many thanks for any help,

    Rory. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter wp-rory

    (@wp-rory)

    Hi,

    Esmi many thanks for your reply. In the end I just removed the URL field altogether from my theme’s comments.php and replaced this line in the same file (that I think I may have earlier removed) which allows for the comment author to be displayed as plaintext if no URL is supplied:

    <strong><?php comment_type('Review','Trackback','Pingback'); ?></strong> from <strong><?php if ('' != get_comment_author_url()) { ?><a href="<?php comment_author_url(); ?>"><?php comment_author() ?></a><?php } else { comment_author(); } ?></strong>

    Notice I also replaced the ‘Comment’ comment type with a more relevant name for my site – ‘Review’.

    All the best,

    Rory. ??

    I’m on version 2.8. What i did instead was to go to the comments.php inside the theme folder and find this line:

    <input type="text" name="url" id="url"
    value="<?php echo esc_attr($comment_author_url); ?>"
    size="22" tabindex="3" />
    <label for="url"><small>Website</small></label>

    and comment it out like this

    <!--<p><input type="text" name="url" id="url"
    value="<?php echo esc_attr($comment_author_url); ?>"
    size="22" tabindex="3" />
    <label for="url"><small>Website</small></label></p>-->

    It removes the field completely where a comment author can enter a URL which is great for future comment. To also remove the hyperlink overall from the author name (like I needed to because I had close to 100 comments already with author name hyperlinked) I found the following instructions (thank you techallica.com)

    1. Go to the wp-includes directory in your wordpress installation via ftp, locate a file called comment-template.php (in older versions of wordpress you would need to find comment-functions.php) , download the file, create a backup of the file to make sure you can upload a working copy in case you mess up.

    2. Open the php file with notepad (any text editor) or any code editing software you may have. Do search and locate a function called: get_comment_author_link()

    You will see the line:
    $return = "<a href='$url' rel='external nofollow'>$author</a>";

    Replace that with:

    $return = $author;

    These two solutions did the trick for me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Disable URL for Comment Author’ is closed to new replies.