Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Add nofollow to links


jcrens8392
Member

@jcrens8392

I know this post is rather old, but none of the above suggestions worked. The problem with using the post_author_link or even get_user_link filters is that those only filter the “href” attribute, not the entire “a” tag. That means you can’t add rel=”nofollow” using those filters.

I wasn’t able to figure out a way to get it done without editing the core. I suggest the post_author_link() function around line 1747 of bb-includes/functions.bb-template.php be edited to allow the option of only returning the link rather than echoing it. That way, you can output the author links in your template (post.php) using something like this:

<?php bb_rel_nofollow(post_author_link(false)); ?>

With the “false” parameter telling WordPress to return the link rather than echo it. I believe that would work for future releases.

As for now, I believe you’ll have to open bb-includes/function.bb-template.php and edit the post_author_link and post_author_avatar_link functions to add rel=”nofollow” to the “a” tags. Those functions begin around line 1747 of bb-includes/function.bb-template.php.

Hope that helps.

Skip to toolbar