Problem with the links on comments.

Written by vidarlo on 20090113 in english and rants and software with one comment.

Sadly, I had a minor problem with the links from the comments to the targets of those links… WordPress somehow URL-encoded the ' rel='external nofollow'-part into the URL, resulting in something like <a href=''rel='external nofollow'>link text</a> which – needless to say – did not really work that well. Turns out the culprit was in comment-template.php on line 148 (Vanilla wordpress 2.7), which reads $return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";. I simply replaced the ‘ with \", and suddenly everything works. Damn strange I’m the only one with this problem tho.
The full line, changed, reads the following:

$return = "<a href=\"$url\" rel=\"external nofollow\" class=\"url\">$author</a>";

1 Response to “Problem with the links on comments.

  1. I guess it’s because single quotes are not XML, so is allowed in HTML but not in XHTML