How to fix comment reply nesting in WordPress

A couple of months back I migrated this website from a different content management system to this one, which runs on WordPress. The transfer of all data went as expected but I noticed that all my comments were not displaying correctly.

Prefer to watch this fix? A video demonstration is at the bottom of this post!

In the example below you can see a comment by Ruth and above it, my response to this comment. (Click to view in full size)

What we should be seeing here is my comment showing under the one submitted by Ruth, that way it’s very clear which comment I am responding to. Some of my posts which multiple comments look a mess.

So how do we fix this? It’s actually pretty straight forward, however may be a little daunting if you’ve never worked with a database before. The fix for this is to first first the Comment ID for the comments you wish to fix. In the example above I need to know the Comment ID for both Ruth’s comment and my own. What I’ll then do is access the WordPress database, find the comments table, find my comment using the ID I noted previously and change the Comment Parent to the Comment ID for Ruth’s comment. I hope that makes sense?

First let’s find the Comment ID. Whilst logged in to WordPress as an administrator, hover (Don’t click!) over the Edit button and note the URL that displays at the bottom of the screen. In the example below the Comment ID is 111.

Remember to note the Comment ID for the reply (This is the record we’ll change) and the Comment ID of the comment the reply is to – this will be the Comment Parent.

Now you’ll want to access the database for your WordPress installation. For most people this will be as simple as logging into your hosting account and accessing phpMyAdmin but not all hosts are the same. When you do access your WordPress database you’ll want to expand the tables and access the table with comments in the name – the prefix of the tables is what you, or your host entered during install. For mines as you can see below it is dMnGVcomments.

Clicking on the table will display a record per comment on your blog/website. At this stage you’re looking for the reply using the Comment ID. When you find this record, click to open it and you’ll see all the fields associated with the record for the comment.

Find the field for comment_parent and change the value from 0 to the Comment ID of the comment the response is to.

Once you are happy with the change, go back to the post and check that your changes have worked. You can see my fix to the comment shown at the start of this post.

Did this help you out? If so, please let me know. I love hearing success stories from others. Curious as to a batch way of fixing hundreds of them? Unfortunately I don’t think this is possible and I’m currently working my way through fixing my own!

2 thoughts on “How to fix comment reply nesting in WordPress

Leave a Reply

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