standard post format icon

Move WordPress Comment to Another Post

There have been several instances when my visitors comment on the wrong post, but I don’t blame them. Maybe it’s because of my note in the comment section that says “For non-post related comment, please visit my Guestbook”. But sometimes those comments meant for other posts like “Attic Cat Jung da Bin” and other 3-year-old posts are “misplaced” in the Guestbook page.

Finding a way to move the comments to their “rightful owner” or to the right post, I found a useful  WordPress Tip: Move A Comment From A Post To Another article from Deluxe Blog Tips.

Requirements

To be able to move the comments you need to know these 3 things first:

  • comment’s ID –  the ID of the comment you want to transfer
  • source post’s ID – the ID of the post where the comment will be removed
  • destination post’s ID – the ID of the post where the comment will be moved/transferred

To know the comment’s ID and the source post’s ID, go to the Edit Comments Page in your Admin Area and hover the mouse on the Approve/Unapproved link in the comments column. You will see the URL in the status bar. However if you’re using Chrome like me, you may not be able to see the full URL, so just right-click and copy the link address and paste it somewhere else, in a blank tab, notepad, etc.

comment ID and source post ID's link

You will see a link similar to this:

http://www.yourdomain.com/wp-admin/comment.php?action=unapprovecomment&p=171&c=12525&_wpnonce=01bb47e1ad

The comment’s ID is 12525 and the source post’s ID is 17, as indicated in p=171 and c=12525.

To know the destination post’s ID, go to the Edit Posts Page and move the mouse over the Post Title. You will see the URL in the status bar that is similar to this link:

http://www.yourdomain.com/wp-admin/post.php?action=edit&post=15

Now we know that the destination post’s ID is 15, as seen from post=15.

Moving the comment using SQL

“I like to move it move it”

To move the comments you have to login to your site’s Control Panel and go to PHPMyAdmin to work with MySQL query. Although this is an easy task,  use phpMyAdmin at your own risk. Be sure to backup your database too, to be on the safe side. 🙂

Choose your WordPress database, and click on the SQL tab.

Now, we’re going to use these SQL snippets

UPDATE wp_comments SET comment_post_ID=destination's post ID WHERE comment_ID=comment's ID;
UPDATE wp_posts SET comment_count=comment_count+1 WHERE ID=destination's post ID;
UPDATE wp_posts SET comment_count=comment_count-1 WHERE ID=source post's ID;

move comment to different post

Type the following queries in the SQL tab and press Go, but be sure to replace it with your own comment and post IDs.

UPDATE wp_comments SET comment_post_ID=15 WHERE comment_ID=12570;
UPDATE wp_posts SET comment_count=comment_count+1 WHERE ID=15;
UPDATE wp_posts SET comment_count=comment_count-1 WHERE ID=171;

WordPress will not automatically fix the comment count that’s why we have to add 1 to the destination post and delete one from the source post.

If your WordPress Database Table prefix  is not wp_,  (such as  wp_comments and wp_posts), replace wp_ with the prefix you're using.

If you did as instructed above, you will see this message:

Your SQL query has been executed successfully

Refresh the Comments Page and you will see that the comment has been moved to the other post.

comment moved to another post

I try not to use plugin if I can do it myself, but for those who prefer to use a plugin you can use

Move WordPress Comments Plugin
Author:Nicolas Kuttler
This plugin allows you to move comments  to a different page and to fix comment threading.

8 thoughts on “Move WordPress Comment to Another Post

    • Thanks, but not really, I only wish! haha.. still learning 🙂
      I think so… maybe it's just me, but I want to move those misplaced comments to where they should be.

  1. The only thing I can execute on PhpMyAdmin is to back-up my database. And I get nervous everytime I do it. 🙂 If I do this maybe I'll pass out na. I prefer the plugin na lang siguro. As far as I can remember, it happened once lang din na may comment na nasa ibang post but I just left it as it is. Anyhow, this tip is for advanced user like you.
    Marlene shares Wok Master WannabeMy Profile

  2. Thanks for the great tip!!

    I would rather keep the misplaced comments as it is though, since it can become a bothering task. 😛