WordPress Plugin: Comment Connection

Wordpress logoHave you ever had a lot of comments on a blog post and had trouble following the conversation? Now you can have no trouble at all, with my new WordPress Plugin – Comment Connection.

Comment Connection is a simple plugin that detects the @commenter reference in a comment and turns that name into a link to a previous comment. An example can be seen on this post. It works by filtering comments when they are printed, then retrieves the comment ID of the last comment made by the person being referenced. There is no modification necessary to make it work, and it will work with previous comments as well.

It has been tested with the most recent version of WordPress, 2.7. If you have problems with an earlier version, or even if it works properly, please contact me or post a comment.


Inside a comment, write @commenter where commenter is the name of the author you are replying to, followed by a line break, colon, comma and now a dash.

Download latest version of Comment Connection


  1. Copy the folder comment-connection to your WordPress plugin folder (usually wp-content/plugins).
  2. Open the WordPress Admin Panel and activate plugin.


  • Commenter reference must be an exact match of the original author’s name.
  • One database query for every comment with a reference.
  • Only links to the last comment made by the author before the current comment.
  • Author name cannot contain more than 2 spaces.


What is the purpose of this plugin?
Comment Connection allows you to follow conversations that take place in post comments by linking them together automatically.

What symbol triggers the response?
Since version 1.1, both a new line and : activate the plugin.

Will the plugin work if I use a different case?
Yes. Comment Connection will still find the reference if the case is different. Ex. @john smith: will reference the comment by John Smith.


v1.0 –– May 1, 2008
* Initial release

v1.1 –– May 1, 2008
* Added support for using : on the references
* Optimized code to limit the database queries to 1 per comment with a reference

v1.2 –– May 1, 2008
* removed the need for PHP buffer

v1.3 –– May 3, 2008
* changes mode of reference detection
* processes comments with multiple references

v1.4 — May 19, 2008
* update readme file

v1.5 — May 22, 2008
* Added support for comma activation

v1.5.1 — July 28, 2008
* Cleaned up code and readme file

v1.6 — January 6, 2009
* Updated for WordPress 2.7
* Added dash separator

View all plugins
[tags]Wordpress, blog, plugin, comments[/tags]

{ 24 comments… add one }

  • wesg April 22, 2008, 10:15 am

    Sample comment 1

  • wesg April 22, 2008, 10:15 am


    Sample response

  • impropio May 1, 2008, 10:37 am


  • Dave M. May 1, 2008, 11:19 am

    @wesg: So what happens when there are two comments by the same author? How does it know which one to link to? I’m guessing it doesn’t.

  • Dave M. May 1, 2008, 11:21 am


    So I also have to use a line break to separate the reply name from the rest of the comment. Why is this? Something to do with the code that is used to find the at symbol followed by the name? Hmmm.

  • wesg May 1, 2008, 11:24 am

    @Dave M.
    At this point the plugin always links to the last comment made before your post. So for example in your comment you say @wesg, you’ll notice that the comment it links to is the last comment I made before yours.

    And yes, right now it uses a line break to find the comments. I hope in the next version, I will be able to add : support as well.

  • wesg May 1, 2008, 9:56 pm

    @impropio: Sample response 2, using version 1.2

  • Christopher May 2, 2008, 12:32 am


    I quite like this plugin, however, there is one small caveat: The replace function replaces *any* ocurance of the author’s name with a link, not just the first ocurance. Something like str_ireplace("@".$author, '@' . $author . '', $comment) works much better.

  • Trisha Cupra May 2, 2008, 3:24 am

    @wesg: I have WP 2.5.1 installed, and I’m only getting the first @commenter being linked when I have two @commenters (new paragraph for second one) in one comment.

    @Dave M.: Just testing to see what happens here…

  • Trisha Cupra May 2, 2008, 5:12 am

    I should have said @wesg and @Dave M.

  • Trisha Cupra May 4, 2008, 12:42 am

    Wow, you fixed it with the update. Wonderful! Thanks.

  • Elliott Cost May 14, 2008, 6:00 pm

    Pretty cool plugin. Nice job!

  • willy May 22, 2008, 1:01 am

    @Elliott Cost test

  • wesg May 22, 2008, 6:48 am

    @willy, there needs to be something after the text to activate the plugin. Though you will notice on my comment that I have added comma support.

  • phalkunz May 27, 2008, 6:03 am

    @wesg: i find this plugin really cool. I never thought of something like. Great job!

  • Paradox July 24, 2008, 10:16 pm

    Hey, one annoying typo.

    In the code, at line 67, you said “str_ireplace”.

    If a user doesn’t know how to edit this, they may take the errors they will get at face value, and not do anything about it.

    I just remove the i, and it works, but some people, even that is too much.

  • wesg July 24, 2008, 10:45 pm

    Thanks for pointing that out, but that extra i is key to making the plugin work. You’ll notice in my response that Paradox isn’t capitalized, but the replacement still works. Without the i — str_replace — the plugin doesn’t replace words that aren’t the same case.

    For more information, visit http://php.mirror.camelnetwork.com/manual/en/function.str-ireplace.php

  • meohmy December 15, 2008, 9:54 pm

    Cool concept, gonna test it out… thanks!

    @Trisha Cupra: testing…

  • wesg December 16, 2008, 12:49 am

    @meohmy: Thanks for the comment. I edited it slightly because what you had written wouldn’t trigger the response. Since some names have spaces in them, the plugin looks for a character following your reference (in my case, a colon). With no character following your comment, it would not make the change.

  • Eric January 10, 2009, 11:42 am

    @wesg: Great !

    Edited by Wes to include an @ 😀

  • test April 27, 2009, 4:35 am

    Ye that seems cool

  • mk January 28, 2010, 10:23 pm

    This works with tons of WP versions, just not 2.9.1

  • juan April 16, 2010, 6:04 pm

    in my 2.9.1 not work too

  • Testperson August 29, 2010, 1:46 pm

    @juan: Mal gucken, ob das funktioniert. 😉

Leave a Comment

Next Post:

Previous Post: