Blog

My new folio's just gone live. Now to have a picnic in my living room :o) (13 hours ago)

WordPress Recent Comments Link Not Working

I recently upgraded my blog to the latest version – WordPress 2.7 and have found a small bug which I’m not entirely sure wasn’t there before, but I only noticed it today after the upgrade.

I use the Recent Comment widget on the sidebar to display recent comments on my posts in the form of “{authorLink} On {postLink}”. I noticed that the author link (links to website of whoever posted a comment on one of my posts) didn’t seem to work in all browsers accept Google Chrome (strangely enough).

On further investigation into the source of the page, I realised that for some reason the link generated was urlEncoded and not formated right.

e.g ‘http://www.example.com%27%20rel%3D%27external%20nofollow’

instead of “http://www.example.com” rel=”external nofollow”

After a few minutes of debugging and digging around through the wordpress pages. I eventually found the source of the problem located on line 148 in category-template.php in the wp-includes folder.

$return = “<a href=’$url’ rel=’external nofollow’ class=’url’>$author</a>”;

I simply changed the line above to

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

and that sorted out the format of the output string and PRESTO the links work again.

* UPDATE – 9th February 2009
Just a heads up on this post.
Some WP users have reported that they’ve found the line in question in “comment-template.php” and not in “category-template.php”. So if you cant find it in one of them, it’s most likely in the other.

8 Comments


  1. David Steadson
    Jan 29, 2009

    Thanks! Just noticed this same problem myself, however the line was in comment-template.php, not category-template.php


  2. Vern at AimforAwesome
    Feb 09, 2009

    That’s awesome! I’m glad you found it. You realize you are the ONLY person in google to have had this error and did something about it (in English)?

    The other was spanish I believe. Thanks SO much for your help…


  3. Vern at AimforAwesome
    Feb 09, 2009

    well, didn’t work – Didn’t find it in category template. Found it in comment template. Replaced the line- it broke the whole blog. Copied over original from WP install (2.7) and blog works – links still broken. Hmm…… bummer!


    • henry
      Feb 09, 2009

      Hi Vern, do you have a link to your blog where you have the recent comments widget activated so I can have a look at the source of your page and see if I can help you sort it out.


  4. greg
    Feb 13, 2009

    I was able to fix this by just deleting

    rel=’external nofollow’ class=’url’

    it doesn’t open in a new window, but it does open.


  5. koma
    Mar 27, 2009

    hi. i found you searching google with “comments url doesn`t work”. i don`t know where to look, please help me. some of my commenters links doesn`t work at all, others are broken because of rel=nofollow item newly added i presume.


    • henry
      Mar 27, 2009

      Hi, I could try be of some assistance or at least guide you the right way. Do you have an example page up with this problem that I could have a look at and try figure out where your links are malformed?


  6. mike
    Dec 03, 2009

    Just noticed this on the company blog! Cheers for the heads up. Hopefully someone will be able to get in and get this issue sorted. Wish I’d noticed sooner that they were using literal quotes by mistake in the code.

Leave a Reply