Comment replies not working on your WordPress Oxygen website? It could be Yoast removing replytocom

8 March 2020

If your WordPress website is built using the Oxygen visual site builder and includes the 'Comment form' component, you may notice that the 'Reply' link underneath individual comments is not working. The link appears, but clicking on it does nothing.

Tempting as it is to attribute this to Oxygen itself, in my case the problem was caused by the very reputable SEO plugin Yoast SEO. The plugin automatically removes a WordPress feature called replytocom (though has a valid SEO reason for doing so). As explained in an article on the Yoast website about the plugin's 'hidden features':

This last hidden feature is quite a technical one. In short, [Removal of replytocom variables] prevents your site from creating lots of URLs with no added value. WordPress has a replytocom feature that lets you reply to comments without activating JavaScript in your browser. But this means that for every comment, it creates a separate URL with ?replytocom variables.

The disadvantage of this is that if you get a lot of comments search engines have to index all those URLs, which is a waste of your crawl budget. Therefore we remove these variables by default.

An example of a URL with a replytocom variable is as follows: https://www.technicallyproduct.co.uk/domains-hosting/verifying-a-website-with-brave-rewards-by-adding-a-txt-record-in-advanced-dns-zone-editor/?replytocom=27#respond

Removing the replytocom variable renders it like this: https://www.technicallyproduct.co.uk/domains-hosting/verifying-a-website-with-brave-rewards-by-adding-a-txt-record-in-advanced-dns-zone-editor/#comment-27

Although Yoast feels that relying on the replytocom feature to handle comments is not best practice, it seems that some WordPress themes (and indeed Oxygen websites) do so. Fortunately, if you are in that camp, it is relatively easy to re-enable replytocom variables.

If you are using a WordPress theme, add the following snippet to your functions.php file:

add_filter( 'wpseo_remove_reply_to_com', '__return_false' );

But what about sites built in Oxygen? They do not use a theme and so do not have a functions.php file at all. In this case, the easiest way to add the snippet is by using a plugin such as the brilliant (and free) Code Snippets. Just 'Add new' and then paste in the code into the 'Code' box. Tick 'Only run on site front end'. Like this:

Enable Replytosnippet

Click 'Save changes' and you are done - your 'replytocom' links will work once more.

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © James Clark
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram