comments reply script not working

Sadly my “reply” link for threaded comments is not working.

The current situation:

First i load the comments reply script (check if scripts content load: works) into the <head> using two functions (the first wp_register_script() at the init hook, the second wp_print_scripts() at the wp_head hook):

Read More

Then i add the Reply link:

comment_reply_link( 
     array( 
         'reply_text'   => __( 'Reply', OXO_TEXTDOMAIN )
        ,'depth'        => isset( $args['args']['depth'] ) ? $args['args']['depth'] : (int) 3
        ,'max_depth'    => isset( $args['args']['max_depth'] ) ? $args['args']['max_depth'] : (int) 5
     )
    ,get_comment_ID()
    ,$post->ID
);

which produces this html-output (example)

<a onclick="return addComment.moveForm("comment-11", "11", "respond", "149")" href="/wordpress/?p=149&cpage=2&replytocom=11#respond" class="comment-reply-link">Reply</a>

I got everything according to any recommendation i read:

My comments are within a <div id="comments"> and the comments form above it within a <div id="respond">.

I still get dropped to the #respond-anchor and the comment form above the comments (http://localhost/wordpress/?p=149&cpage=2&replytocom=11#respond), instead of getting the comment form displayed below the comment i want to reply to.

What may i do wrong?

Google, tutorials, how-to and else were so far of no help. Everything seems to be according to the recommended standard…

Thanks a lot.

Related posts

Leave a Reply

1 comment

  1. Don’t link the script file directly. Enqueue it instead, e.g. in functions.php:

    function mytheme_enqueue_comment_reply() {
        // on single blog post pages with comments open and threaded comments
        if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { 
            // enqueue the javascript that performs in-link comment reply fanciness
            wp_enqueue_script( 'comment-reply' ); 
        }
    }
    // Hook into wp_enqueue_scripts
    add_action( 'wp_enqueue_scripts', 'mytheme_enqueue_comment_reply' );
    

    You can also do this, in the document head, prior to the wp_head() call:

    <?php
    // on single blog post pages with comments open and threaded comments
    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { 
        // enqueue the javascript that performs in-link comment reply fanciness
        wp_enqueue_script( 'comment-reply' ); 
    }
    ?>
    

    EDIT:

    Hooking into wp_head, rather than e.g. wp_print_scripts, is important. The wp_print_scripts does not work in the same way that wp_print_styles does, to output stylesheet links.

    So: if you’re using wp_print_scripts, change the hook to wp_head.

    EDIT 2:

    Based on your pastebin-linked code, have you tried the following, to rule out potential issues?

    1. Remove callback function from wp_comment_list()
    2. Move wp_comment_list() call to before comment_form() call
    3. Remove the argument array from comment_form()

    I don’t know that any of those will solve your problem, but they may help us track down its origin.