Skip links

How to Add nofollow to All WordPress Links

If you need to add nofollow to all links in WordPress at just one minute using this code snippet where let you filter by WordPress built-in hooks the_content.

Steps to nofollow links in WordPress:

  1. Open WordPress admin panel then go to Appearance > Theme Editor
  2. Open theme functions.php file, if you work localhost open the same file using any code editor IDE
  3. Add the following code at the bottom of the file.
  4. Save the changes.

function zytheme_links_nofollow( $content ){
$content = str_replace( ‘<a href="’, ‘<a rel="nofollow" href="’, $content );
return $content;

Did you find the WordPress snippets in this article helpful? Share it with your friends and if you have any questions and want to ask us about it, please don’t hesitate to add comments.

Leave a comment