WordPress and Google Analytics external nofollow problem in comment links
13th February 2009
Since some WP release, the comment author’s link in comments is broken – it has ‘ external nofollow’ attached straight to the href attribute (which breaks the link).
I assume that the problem is caused by Google Analytics, namely the “track outgoing clicks” feature (as recalled, might be inaccurate feature name). “Track outgoing links” adds some JavaScript code to all outgoing links, and that script has tick characters like this one ‘ which, incidentally, are also used for delimiting the values of comment anchor tags.
To fix:
- locate file wp-includes/comment-template.php
- in that file, find the get_comment_author_link function (lines 140-150 in WP 2.7.1)
- replace the line
- $return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
with
- $return = '<a href="'.$url.'" rel="external nofollow" class="url">'.$author.'</a>';
This helped me and might help you.
March 4th, 2009 at 1:16
I disabled the GoogleAnalytics.php plugin and my links started working again normally.
March 4th, 2009 at 10:44
My “Google Analytics 0.68″ WP plugin is inactive – I think I’m using HeadSpace for this and other purposes. So it might have the same code for rewriting links