Want to know what WordPress Theme a site is using? Check Out Now!

How to Remove Website URL From Comment Author’s Name?

Comment spamming is one of the common techniques that people use to create backlinks and drive traffic to their website. It is one of the biggest challenges that website owners and bloggers face.

This is the reason why many people end up removing the website URL from the comment author’s name. And the code below helps you to remove the comment author’s link in WordPress.

/**
 * Filters the comment author's link for display.
 *
 * @since 1.5.0
 * @since 4.1.0 The `$author` and `$comment_ID` parameters were added.
 *
 * @param string $return     The HTML-formatted comment author link.
 *                           Empty for an invalid URL.
 * @param string $author     The comment author's username.
 * @param int    $comment_ID The comment ID.
 */
function maverick_remove_comment_author_link($return, $author, $comment_ID)
{
    return $author;
}

add_filter('get_comment_author_link', 'maverick_remove_comment_author_link', 10, 3);

Leave a Reply

Your email address will not be published. Required fields are marked *