This code goes into an infinite loop! What am i doing wrong? There is only one post called “hello there”. The only way to stop it is use break; in while.
Any help appreciated
$gotop="hello there";
$args = array(
's' => $gotop,
'post_type' => 'post'
);
$wp_query = new WP_Query($args);
if ( $wp_query->have_posts() ) : ?>
<?php
while ( $wp_query->have_posts() ) {
$wp_query->the_post();
}
else:
echo "nothing found.";
endif;
?>