Codeable info

How to Manually Nest a Comment in WordPress

Posted on by in WordPress Tutorials

Adam Baird left a comment on my article on WordPress theme frameworks the other day. We both replied to each other a few times using threaded comments but then Adam had to reply at the bottom of the comments because comments only went 5 deep, which is the default level for threaded (nested) comments.

Thankfully changing the level of threaded comments is really easy. You can do this at

Changing the level of threaded comments

Changing the level of threaded comments to 10 at WP Mods does not change any comments which were published before the settings were changed.

Our initial discussion ended like this:

WordPress Threaded Comments

The above comment was in the middle of the comments section. Since my previous comment was at the 5th nested level, Andy had to reply at the bottom of the comments section. This makes following the discussion more difficult (which is why threaded comments were created in the first place).

WordPress Threaded Comments

So how do we move this comment to where it should have been? It’s actually very easy. All you need to do is :

  • Go through your websites hosting area (usually cPanel) and open up your database management script (usually phpMyAdmin).
  • Select the database for your WordPress powered site and then browse the comments table. This is usually called wp_comments though it depends on the table prefix you set in your wp-config.php file (by default it’s wp_).
    Browse the wp_comments table
  • Find the comment_ID of the comment you want to move. You can get this from the comment link (i.e. the URL of the comment) or via the comment area in your WordPress admin area (e.g. click to edit the comment you want to move and you will see the comment_ID in the URL). comment_ID is the primary key of the wp_comments table so you should now be able to find the comment you want to move easily.
  • Click on the edit link to change your comment. One of the last keys in the table is called comment_parent. If a comment has no parent (i.e. is not nested underneath another comment) then it’s value is 0. However, if you enter the comment_ID of another comment it will be nested underneath it. Therefore all you need to do is find out the comment_ID of the parent comment and enter it in the comment_parent field and hit the save button.

For example, if you want to move comment 20 underneath comment 10 you would edit comment 20 in phpMyAdmin and set comment_parent to 10. That’s it.

Once I did this Adams comment was correctly nested underneath our original discussion.

WordPress Threaded Comments

Hope you find this tutorial useful. If you are unsure about any stage please let me know and I will clarify it for you.

Good luck,

Codeable info

Comments (4)

Comment by Pothi Kalimuthu says:

Nice trick and you explained it very well with screenshots.

Thanks, Kevin.

Comment by Ashfame says:

I found it when I searched for it so I guess its not that much popular

Comment by Kevin Muldoon says:

Nice plugin Ash. I’m surprised yet pleased that there is a plugin out there which makes it easier.

Has the plugin proved to be popular?

Comment by Ashfame says:
Codeable info