In my single.php file I am using a nested WP_Query to show more posts, at the bottom of the page. My code for the query and nested loop are as follows:
<?php $ep_args = array( 'post_type' => 'post', 'category_not_in' => 93, 'orderby' => 'rand', 'posts_per_page' => 4, 'offset' => 1, ); $ep_query = new WP_Query( $ep_args ); while ($ep_query->have_posts()) : $ep_query->the_post(); if( $post->ID == $do_not_duplicate ) continue; get_template_part( 'content', 'postthumb' ); endwhile; wp_reset_postdata(); ?> I have tried using both 'category_name' (with the desired category's slug) and 'category_not_in' (with the undesired category's ID), and in both cases I am getting posts from the undesired category. Furthermore, I'm finding that using 'orderby' => 'rand' will only result in 3 posts instead of 4, if I do not set the offset to 1.
How can I get my query to result in 4 posts from one specific category, and no other categories?
if ( $ep_query->have_posts() )to prevent reseting the post data if it was never set