Rapid Comment Reply for WordPress

Note: this will be deprecated upon the release of WordPress 5.0 as the plugin will be integrated into WordPress core.

WordPress sites using threaded comments are advised to include the comment-reply.js script included in WordPress core. As the script is included in every version of WordPress, the theme developer can simply enqueue the script if required and WordPress does the rest.

Unfortunately, the version of the script included in WordPress core is not unobtrusive. The typical comment reply link in WordPress looks something like this:

<a class='comment-reply-link' href='/sample-post/?replytocom=1#respond' onclick='return addComment.moveForm( "div-comment-1", "1", "respond", "6" )' aria-label='Reply to John Smith'>Reply</a>

I’ve detailed some of the problems with this in WordPress trac ticket #31590. Rather than submit a patch and hope it works, I’ve decided to write it as a plugin and dog food it on my site as a plugin first. The initial version of the plugin uses unobtrusive JavaScript to call the existing functions and add events. The links now include data-attributes:

<a class='comment-reply-link' href='/sample-post/?replytocom=1#respond' data-comment-id="1" data-post-id="6" data-add-below-element="div-comment-1" data-respond-element="respond" aria-label='Reply to John Smith'>Reply</a>

This is the first pass, you can download the plugin now or follow the development on Github, where pull requests and issues are welcome.