get_comments_number of depth-1 (Level 1) (1 post)

In the wp_comments table, if comment_parent equals 0, it’s a first-level comment.

function get_num_toplevel_comments() {
    global $wpdb;

    return $wpdb->get_var("
        SELECT COUNT(*) 
        FROM $wpdb->comments
        WHERE comment_parent = 0
    ");
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)