Moving WordPress comments
Edit: I wrote a plugin to make this easier, see the move WordPress comments plugin page.
Do you sometimes get comments that should be on a different post or page on your WordPress blog? I get such posts from time to time and always wondered how to move them to a different post. It turns out to be quite easy.
The information, on which post or page your comment resides, is stored in the wp_comments table of your blog database, in the comment_post_ID column. So use your favorite mysql client (like phpmyadmin) and change it.
If you don't know how to find the comment: you can get the comment's comment_ID in several ways, for example by hovering over the Edit comment link in your dashboard. To get the desired comment_post_ID you can use the same strategy and hover over the Edit post link.
I prefer to use the command line mysql client, and the plain SQL statement looks like
UPDATE wp_comments SET comment_post_ID=XXX WHERE comment_ID=YYY;
XXX is the ID of the page you want the comment to be on, YYY is the comment's ID. If in doubt, refer to the fine manual.By the way, if you want to fix the threading of a comment, my guess would be that you need to change the comment_parent to the parent comment's ID. I will update the post when I tried that.
Edit: You should also do this the following:
UPDATE wp_posts SET comment_count=comment_count+1 WHERE ID=XXX;
UPDATE wp_posts SET comment_count=comment_count-1 WHERE ID=YYY;
XXX is the target page, YYY is the page where the comment was before.
I am Nicolas Kuttler, a web developer, system administrator and IT consultant from France, currently living in Germany.





2 comments
Start a new thread