此代码进入无限循环!我做错了什么?只有一个帖子叫“你好”。阻止它的唯一方法是使用break;
很快。
感谢您的帮助
$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;
?>