Skip to content

How to Control the Total Amount of Links in WordPress

Besides, the content and quality of a webpage, the total amount of links is a big matter for search engines and users. Let’s find why it is a big matter and how you can control it. A page with too many outgoing links can be considered as a web portal. And this is now a spam practice to put too many links on a page. So what, if people love your blog and like to drop a comment below of your post. Sometimes, this type of comment can be reached 100 or so far.

Here’s how you can control your blog post and comments:

  1. Removing <a> tag from comment name: You can control your outgoing links by removing HTML link element from the comment name of your blog. For WordPress, you can use the following template to make it non-hyperlinked. This way the author’s name will not turn into a hyperlink. Just go to the core files from wp include and open “comments.php” in a text editor. Find the following line: <?php comment_author_link() ?> and replace it into: <?php comment_author() ?>
  2. Using function.php: If you don’t want to edit the core file you can remove the URL field from your comment template adding this code in your functions.php file.
function vh_remove_post_author_weburl($return) {
     global $comment, $post;
     if ( !is_admin() ): 
     //only run outside dashboard
     if ( $comment->user_id == $post->post_author ) {
     $author = get_comment_author( get_comment_ID() );
     $return = $author; 
     //return post author display name only
     return $return;
     else {
     return $return; 
     //return default
add_filter( 'get_comment_author_link', 'vh_remove_post_author_weburl');

Now, simply add this filter to remove the URL field from your comment template. So, the name of your commenter will no longer turn into a hyperlink.

By editing single.php: Every theme contains a specific template named single.php to generating the post. You can simply edit this template and remove <?php comment_template () ?> to disable the comment from all landing pages.

Turn off the comment after a reasonable number: If you are still not willing to change anything or don’t understand the PHP code’s, you can directly control it from the WordPress dashboard. Go to the settings> discussion and check “Automatically close comments on an article older than (put a number here) days. See the picture below:

There are four methods that you can use to control your comment link and keep you outgoing links under 100. Still, confused? Drop your question now, and we are ready to help!