disable comments if array exists

Assuming you’re properly using comment_form() to output the comment reply form:

if( ! array_key_exists( 'comments', $wp_query->query_vars ) ) {
    // Output the comment form
    comment_form();
}

Edit

Based on your comments.php code:

// If the user isn't logged in, don't display comment form
if ( is_user_logged_in() ) {
    global $wp_query;
    // If the post type isn't 'debate',
    // Or if the 'comments' array key exists in the query
    // Display the comment form
    if ( 'debate' != get_post_type() || ! array_key_exists( 'comments', $wp_query->query_vars ) ) {
        comment_form();
    }
}

I’m taking a complete stab in the dark here, because it’s not entirely clear how your comments template is being included in your template.

Edit 2

I don’t think this will work as intended:

if ( comments_open()  )

comments_template( '', true );

See that extra line break? Without curly braces around your conditional, the two lines aren’t related. You need to do one of the following:

if ( comments_open() )
    comments_template( '', true );

or, better yet:

if ( comments_open() ) {
    comments_template( '', true );
}

Leave a Comment

error code: 523