Created
March 3, 2013 20:28
-
-
Save eteubert/5078138 to your computer and use it in GitHub Desktop.
WordPress: move comments between posts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function move_comments( $from_post_id, $to_post_id ) { | |
| global $wpdb; | |
| $sql = sprintf( | |
| 'UPDATE %s SET comment_post_id=%s WHERE comment_post_id=%s;', | |
| $wpdb->comments, | |
| (int) $to_post_id, | |
| (int) $from_post_id | |
| ); | |
| $wpdb->query( $sql ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment