DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

Even if this is quite rare, it happen sometimes that someone leave a comment on a post instead of another one. In that case, it is possible to move the comment by using phpmyadmin and sql.

First of it all, login to your phpmyadmin and choose your WordPress database. Once done, click on the sql button to open the sql command window.

Now, we have to get the ID of each post. Once you have it, run the following command on the SQL window:

UPDATE wp_comments SET comment_post_ID=NEW_ID WHERE comment_post_ID=OLD_ID;

Right now, the comments are moved, but we need some extra queries to finish the job: WordPress tracks the number of comments per posts.

The following query will give you the number of comments under the old post:

SELECT comment_count FROM wp_posts WHERE ID=OLD_ID;

We have to run theses two last SQL commands to finish the job. COMCOUNT is the number we get with the previous query.

UPDATE wp_posts SET comment_count=comment_count+COMCOUNT WHERE ID=NEW_ID;
UPDATE wp_posts SET comment_count=comment_count-COMCOUNT WHERE ID=OLD_ID;

Right now, all comments from a post have been successfully moved to another post.

Source: G Loaded

One Comment

  1. Nikhil Naik

    Hmmm, Quite interesting. But this might be shocking for those the regular visitors of one’s blog when they find that the comment which they had earlier posted on a particular article is being displayed elsewhere..!

    But of course, such kind of experimentation can always help you reach the depths of WordPress.

Leave a Comment

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