WordPress Loop with Custom Post Type for Bootstrap Accordion [closed]

You put the accordion inside the loop, that’s why it is not working as you want.

Try this:

<?php
    $args = array(
      'post_type' => 'review'
    );
    $the_query = new WP_Query($args);
  ?>

    <div class="row mb-5">
      <div class="col-md-9">
 <div id="accordion" role="tablist" aria-multiselectable="true">
        <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : ?>
        <?php $the_query->the_post(); ?>


          <div class="card">
            <div class="card-header" role="tab" id="heading<?php the_ID() ?>">
              <h5 class="mb-0">
                <a data-toggle="collapse" data-parent="#accordion" href="#collapse<?php the_ID() ?>" aria-expanded="true" aria-controls="collapse<?php the_ID() ?>"><?php the_title(); ?></a>
              </h5>
            </div>

            <?php rewind_posts(); ?>

            <div id="collapse<?php the_ID() ?>" class="collapse <?php echo ($the_query->current_post == 0 ? 'show' : ''); ?>" role="tabpanel" aria-labelledby="heading<?php the_ID() ?>">
              <div class="card-block">
                <span><?php the_content(); ?></span>
              </div>
            </div>
          </div>


        <?php endwhile; endif; ?>
</div>
      </div>
    </div>

    <?php wp_reset_query(); ?>