Simple & Easy Help
for WordPress Beginners

Remove comment author link and comment URL

Get the Latest from Sniffle Valve

Sniffle Valve logo

If you find this quick tip to be helpful and of use, consider buying Sniffle Valve a coffee  

For help with the content presented in this quick tip, book a one-on-one online training session

These two items are responsible for a lot of the spam comments that are entered on a WordPress. Removing them has the potential to cut down on the number you receive.

Adding the first block of code below will remove the author link from existing Recent Posts displays where the author has entered a website URL in the comments area. Note that the author link in the actual comments listing on the post will remain; you would have to manually remove the URL from the Comments section in the Admin dashboard.

The second block of code will remove the Website field (comment URL) from the comments area preventing any further misuse of this “feature”.

Use the Code Snippets plugin to add the code presented and create and activate a new snippet for each block.

As always, read and understand the Sniffle Valve Disclaimer before proceeding.

add_filter( 'get_comment_author_link', 'remove_html_link_tag_from_comment_author_link' );
function remove_html_link_tag_from_comment_author_link ( $link ) {
if( !in_the_loop() ) $link = preg_replace('/<a href=[\",\'](.*?)[\",\']>(.*?)<\/a>/', "\\2", $link);
return $link;
Remove Comment Author Link
add_filter('comment_form_default_fields', 'website_remove');
function website_remove($fields)
return $fields;
Remove Comment URL (Website field)

Leave a Comment