Using Query Loop Block to list all posts under each category

Use WP_Query directly in your WP theme template files instead of a block editor.

// Define custom taxonomy (category) terms
$categories = get_terms(array(
    'taxonomy' => 'your_custom_taxonomy', // Change 'your_custom_taxonomy' to the name of your taxonomy
    'hide_empty' => false,
));

// Loop through each category
foreach ($categories as $category) {
    echo '<h2>' . $category->name . '</h2>'; // Display category name
    echo '<ul>';

    // Query posts based on the current category
    $category_query = new WP_Query(array(
        'post_type' => 'your_custom_post_type', // Change 'your_custom_post_type' to the name of your custom post type
        'posts_per_page' => -1,
        'tax_query' => array(
            array(
                'taxonomy' => 'your_custom_taxonomy', // Change 'your_custom_taxonomy' to the name of your taxonomy
                'field' => 'term_id',
                'terms' => $category->term_id,
            ),
        ),
    ));

    // Loop through posts in the current category
    while ($category_query->have_posts()) {
        $category_query->the_post();
        echo '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>'; // Display post title with permalink
    }

    echo '</ul>';

    // Reset post data
    wp_reset_postdata();
}

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