Make existing comments threaded (Edit comment_parent field of comments)
-
Since WP?2.7 we have new threaded comments functionality.
Let us suppose that I have enabled threaded comments is WP and have made required modifications to my theme. Now visitors can reply to existing comments, making threaded comments.
But old comments are still plain (not threaded), because all of them are stored in the database as replyes to the post, not as replyes to another replyes.
I want to edit old comments (their comment_parent fields) to make them threaded too. But WordPress does not allow me to edit comment_parent! When I press “Edit comment” link, I can edit author name, author url, even the time of comment, but not the parent of this comment!!!
I decided to fix this problem. I have edited the wp-admin/edit-form-comment.php and added after
<td><input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" class="code" value="<?php echo esc_attr($url); ?>" tabindex="3" /></td> </tr>
the following:
<tr valign="top"> <td class="first"> Comment parent: </td> <td> <input type="text" id="newcomment_parent" name="newcomment_parent" size="30" class="code" value="<?php echo esc_attr($comment->comment_parent); ?>"/> </td> </tr>
Then I edited wp-admin/includes/comment.php, I have added after the following line:
$_POST['comment_ID'] = (int) $_POST['comment_ID'];
this one:
$_POST['comment_parent'] = (int) $_POST['newcomment_parent'];
Finally, I edited wp-includes/comment.php, modified the following line:
$data = compact('comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_parent', 'comment_date', 'comment_date_gmt');
in the wp_update_comment function.Now I can see the value of comment_parent field in the comment editor, but this value does not update when I change it and press “Update comment” button.
I am shure that I have missed something when edited WorpPress source.
Dear WordPress users! Where I should modify WordPress to be able to edit comment_parent fields of comments?
- The topic ‘Make existing comments threaded (Edit comment_parent field of comments)’ is closed to new replies.