I rewrote my code to use WP_Query but unfortunately this method returns all posts instead of posts assigned to a specific category.
<?php
$args = array(
'post_type' => 'cars',
'posts_per_page' => -1,
'taxonomy' => 'car_category',
);
$the_query = new WP_Query( $args ); ?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post();?>
<a href="<?php the_permalink(); ?>">
<?php echo the_post_thumbnail(''); ?>
</a>
<?php endwhile; ?>
<?php else : ?>
<p>Sorry, no products found.</p>
<?php endif; ?>
<?php wp_reset_postdata() ?>
<?php wp_reset_query() ?>