WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] comment-reply.js breaks makes comment_parent value always 0 (2 posts)

  1. Salvatore Formisano
    Member
    Posted 2 years ago #

    Hi all,

    I'll start by saying that I experimented a lot before posting. I guarantee that comment-reply.js is properly included, as proof clicking on the 'reply' link moves the form right under the comment I want to answer to.

    The problem: when js is on, if I try to reply to a comment, the new comment will still have a comment_parent value of 0, hence making it a new comment and not an answer.

    My attempts:
    1) removing all javascripts and deactivating all plugins leaving JUST comment-reply.js - result, still broken
    2) Deactivating javascript completely, WORKS
    3) Manually changing comment_parent value input trough firebug - if JS is on still no luck.

    So basically, when js is on and comment-reply.js is included, I get the nice form moving around thing, but then comment_parent breaks.

    Mind this, I checked with web dev tools on chrome and firebug on firefox, the comment_parent input DOES GET UPDATED with the parent it. So you would see that input being updated every time you hit a reply link.

    Simply said, on submission, once we reach /wp/wp-comments-post.php $_POST['comment_parent'] has suddenly become a 0.

    I logged the whole $_POST many times at the top of the file to know just what comes out of the form. When js is off or comment-reply.js is excluded, all working. When comment-reply.js is running, comment_parent == 0.

    Rings any bells? Is this a known issue?

    Thanks so much, this took the last 3 hours of my life and I got nowhere yet.

  2. Salvatore Formisano
    Member
    Posted 2 years ago #

    Just in case anyone ever stumbles into a similar problem, I was using the 'comment_form' function with my own defined fields.

    I had then attached the output of the get_comment_id_fields() function to comment_field. I had read that in order to make threaded comments work you had to manually add this output. Turns out wordpress attaches those fields by itself without the need for you to add them to a different field.

    I hope this will save someone some time

Topic Closed

This topic has been closed to new replies.

About this Topic