Load custom formatted comment with AJAX: reply link isn’t rendered?

It appears you can get max_depth from the options via get_option('thread_comments_depth'):

function prefix_submit_ajax_comment(){
    $comment = wp_handle_comment_submission( wp_unslash( $_POST ) );

    ...handle errors and get $comment_depth...

    $GLOBALS['comment'] = $comment;
    $GLOBALS['comment_depth'] = $comment_depth; 
    $args['max_depth'] = get_option( 'thread_comments_depth' ); // solution 

    op_format_comment($comment, $args, $comment_depth);
}

Leave a Comment