• I am in the process of creating a theme and some how have broken threaded comments. Having traced through the code I have checked up to this in a custom wp-comments-post file:

    $comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0;
    $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
    print_r($commentdata);
    $comment_id = wp_new_comment( $commentdata );

    which outputs correctly:

    Array ( [comment_post_ID] => 20 [comment_author] => Tim H [comment_author_email] => *deleted* [comment_author_url] => [comment_content] => tes4 [comment_type] => [comment_parent] => 8 [user_ID] => 0 )

    however in the database comment_parent is zero ?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Unless a filter has been added that’s messing with the value, the only reason it would get set to 0 is if the parent’s status does not come back as either ‘approved’ or ‘unapproved’.

    If that checks out, you may need to trace into wp_new_comment() to identify exactly where it’s getting set to 0.

Viewing 1 replies (of 1 total)
  • The topic ‘comment_parent not storing’ is closed to new replies.