How to disable the link in the comment author name on a web post

Are you having spamming links in the comment author name on your web post (articles)? By default, WordPress generates comment author links that lead to the author’s website. Thus, some people use this opportunity to get backlinks to their websites. In this step-by-step guide, I will show you how to disable the link in the comment author’s name on a WordPress-powered web post and page (article).

In some cases, you may prefer not to give backlinks to websites that you don’t like while some spammers are typing their web page URLs when commenting on your website to get backlinks (most sadly, to websites that hurt your website ranking, SEO, and security).

So, disabling comment author links is the recommended thing you can do and in today’s article, I will show you how to do it step-by-step. Hope this will be helpful. You may also see our expert guide on how to troubleshoot errors on WordPress.

Now, let us dive in.

There are three methods of removing links from the comment author name on your WordPress blog post or articles. The three (3) methods are:

  1. Removing the website URL field from the comment section so can people can only enter their name, email, and comment content,
  2. Manually removing their URLs when moderating comments and
  3. Adding a PHP code (which we shall discuss later) to your website theme file (function.php).

Method #1 is the best one we recommend you apply because it works by disabling any link that people type in the website field when commenting on your blog post.

So, let us get started.

Adding a PHP code to your WordPress website theme file is the most effective method to disable links in comment author names your your WordPress website or blog post and pages. Let’s delve into how to add that PHP code.

function disable_comment_author_links($author_link) {
    // Remove links from the comment author's name
    return strip_tags($author_link);
}

Above is a PHP code that you should add to your WordPress website theme file (function.php precisely). Copy it to your device clipboard now.

  • This code defines a function named disable_comment_author_links that takes a single parameter, $author_link, which presumably represents the link to the author’s name in a comment.
  • Inside the function, it uses the strip_tags function to remove any HTML tags from the $author_link, effectively stripping any links from the author’s name.

To add this code to your website, simply log in to your WordPress dashboard, and click on Appearance > Theme File Editor. When the theme file editor page opens, click on the Theme function (function.php). Now, it is time to paste this PHP code that you copied to your clipboard earlier.

How to disable link in comment author name on WordPress by adding PHP code in the theme file editor (function.php).

Before you proceed with your website theme file, please back up your website first so that you can revert your website to how it was before you started. You may watch this step-by-step video guide to learn how to back up the WordPress website. I also advise you to add any manual code like this above to your website child theme so that it will not be erased when your theme is updated. Below is how to create a child theme if you have not created it yet, please watch it first.

Another method to disable a link in the comment author name on your web post is by by manually removing their link when you are moderating their comment via your WordPress dashboard. Here is how to do it.

Login to your WordPress dashboard, click on the Comment Menu, and hover over your mouse to the comment (especially the one that you haven’t approved yet). Then remove the website link if the author dropped his website URL. By doing this, you can correct some incorrect words and sentences in the author’s comment content.

Please note that to use this method, ensure that only authorized comments appear on your WordPress web post. You may follow these steps to enable options for comment approval.

  1. Log in to WordPress.
  2. On the left-side menu, select Settings and then Discussion.
  3. In the Before a comment appears section, select the checkbox next to each of the following options to enable them:
    • The comment
    must be manually approved.The comment
    • author must have a previously approved comment.
    To disable either option, clear the checkbox for that option.
  4. (Optional) If you want to be notified whenever you need to approve or delete the comment, in the Email me whenever section, select the box next to A comment is held for moderation.
  5. Scroll to the bottom of the page and select Save Changes.
comment approval

When enabled, these options will prevent spammers from leaving unauthorized comments on your site.

The easiest way to remove the website URL field from your WordPress web post comment form is by using the Comment Link Remove and Comment Tools plugin. This plugin lets you remove the field and also delete any links from comments author name and their content which you have already approved.

To be able to do this, you need to install and activate the Comment Link Remove and Comment Tools plugin. You may see our guide on how to install a WordPress plugin.

When you have activated it, click on QC CLR Settings in the WordPress dashboard.

QC CLR Settings plugin

Here, check the box next to ‘Remove WEBSITE Field from Comment Form.’ This will discourage spammers from inserting their links.

That said, all the comments you previously approved will still contain a link. To remove these URLs, simply check the box next to ‘Remove hyperlink from comment AUTHOR Bio.’

After that, just scroll to the bottom of the page and click on the ‘Save Changes’ button to store your settings.

QC CLR Settings plugin

To see this change in action, either log out of your account or visit your website in an incognito tab.

You will see that the comment form will no longer have a website URL field.

Comment form has lacked website URL field.

Additionally, comment author names that used to have links will no longer have them, and users won’t be able to click on them anymore.

One of the tell-tale signs of this is that the text color of the comment author name that used to have links will be the same as the one that doesn’t.

Comment author name without link

When spammers want to get backlinks from your web post, they make comments that are often off-topic, irrelevant, and add no value to your articles.

By following the methods discussed in this article, you can remove the website URL from the name of your blog post. Feel free to use the last method above (removing the website field from the comment form). Genuine users (these are people you are targeting) will leave a comment no matter whether they get a backlink or not.

We hope this article helped you learn how to disable the link in the comment author name on your WordPress web post or article. You may also want to see our guide on how to troubleshoot errors on WordPress and our guide on how to make money on a WordPress blog in 2024.

If you know that has helped you know how to disable the link in the comment author name on WordPress web posts, then subscribe to our YouTube channel for more updates. You can also find me on Facebook.

5 Comments

  1. Kamaldeen Sadeeq

    I have presently no comment to make. But I felt to appreciate your help on this blog. Thank you sir and may God bless you.

    • Abdul Razaq

      Hi Sadeeq
      Thank you for your feedback

  2. Noah James

    This article has deeply addressed and helped me resolved the issue I have been getting comments on my blog. Thank you sir for creating it.

    • Abdul Razaq

      Hi James
      I’m so glad the article could help you resolve the issue you were facing! thank you for your feedback

  3. Rose 🌹

    Oh boy. Allowing your comment section to be at default is not good at all. If you do that, people will comment unnecessarily on articles in order to get backlinks from your website via their name.

    Importantly this article will show you how to prevent the comments author name from being clickable on your article.

Leave a Reply

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