KNOWNHOST KNOWLEDGE BASE

Hosting Question? Find the Solution - Browse our Guides, Articles, and How-To's

How to Turn off Rel=Nofollow and Make Pingbacks Dofollow?

Category: WordPress
Tags: # # #

As mentioned in the pingback guide overview, pingback links are by default flagged as rel=nofollow.  That means some search engines will ignore, while others will treat as regular dofollow links. When a link is dofollow, search engines will attribute link trust and authority to the linked site, and pull some of that back from the linked site to the original site.

Note:  A nofollow link typically has less value than a dofollow link, in both directions.  This is why some site owners want to change the behavior and make sure that pingback links are NOT flagged as rel=nofollow.

Plugin Method

When you’d like to use a WordPress plugin to change pingbacks from nofollow to dofollow, there’s a lot of choices out there on the market.  

Have a look at this post for some examples of plugins that can achieve this: perishablepress.com/comprehensive-reference-for-wordpress-no-nofollow-dofollow-plugins/

Manual Method

Manually code a change in your functions.php or theme files to remove rel=nofollow from pingbacks.

WARNING – THIS IS ADVANCED – YOU CAN EASILY BREAK WORDPRESS
EDITING FUNCTIONS.PHP MANUALLY CAN RESULT IN CRASHES

How it Works

The idea behind the manual approach is that you’re going to create a function that’s triggered before pingbacks are sent.  It will strip the links out of any pingbacks before anything is sent.

Note that the below function will remove the rel=nofollow attribute from pingbacks, trackbacks and author links.

Credits to Remove Nofollow plugin and Perishable Press:

Set up the function:

  function remove_nofollow($nofollow) {

Strip the nofollow tag:

    $nofollow = preg_replace("/rel='external nofollow'>/","rel='external'>",
    $nofollow);

End the function:

  }

Set the hook action:

  add_filter('get_comment_author_link', 'remove_nofollow');

Full Version of the remove nofollow code:

  function remove_nofollow($nofollow) {
    $nofollow = preg_replace("/rel='external nofollow'>/","rel='external'>", $nofollow);
    return $nofollow;
  }
  add_filter('get_comment_author_link', 'remove_nofollow');

Usage notes:

If you’re using the default theme, edit the functions.php file and then get the theme updated, your changes will be overwritten and gone.

If you’re using the default theme, then change to a different theme, your changes will no longer be present.

Best practices call for themes to be regularly used and updated, so you should put your changes into a child theme so that they are preserved, even when the main theme gets updated.

If you make an error in rekeying the above, omit a bit of punctuation during a copy and paste, or generally make any kind of fat fingering error at all, you can bet that there will be some type of error or crash generated as a result.

Advantage:  Lightweight and solves several nofollow issues.

Disadvantages:  See above notes.  You don’t have fine granularity control of the pingbacks, trackbacks and author links separately.  It’s all or nothing.

As you can see, if you’re an advanced WordPress user, then manual changes could be a good solution.  It’s not recommended for novices!

Conclusion

Have a WordPress website? Check out our Managed WordPress Hosting and see if we are a good fit for you. KnownHost offers 365 days a year, 24 hours a day, all 7 days of the week best in class technical support. A dedicated team ready to help you should you need our assistance. You’re not using KnownHost for the best webhosting experience? Well, why not?