Im trying to get a list of post in a category with this:
$category = get_the_category();
$args = array(
'post_type' => array('post', 'entrevista'),
'cat' => $category[0]->term_id,
'post__not_in' => array(get_the_ID()),
'ignore_sticky_posts' => 1,
'posts_per_page' => -1
);
$queryScience = new WP_Query( $args );
unset($args);
?>
<?php if ( $queryScience->have_posts() ) : while ( $queryScience->have_posts() ) : ?>
<option value="<?php echo get_permalink($queryScience->post->ID); ?>"><?php echo ucwords(get_the_date('M Y', $queryScience->post->ID)); ?></option>
<?php endwhile; endif; wp_reset_query(); wp_reset_postdata(); ?>
I think it goes infinity loop because shows more than 40.000 results. What am I doing wrong?