I've written this code but cannot work out why it's triggering an infinite loop. I have hunted around for similar issues but nothing is clicking for me. Can anyone please shed some light?
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 3
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : ?>
<div class="news_item">
<img src="<?php echo get_template_directory_uri(); ?>/img/dummy.png">
<h3><a href="#">Government introduces X Y Z for lorem ipsum dolor esters.</a></h3>
</div>
<?php endwhile; endif;
wp_reset_postdata(); ?>