I'm currently running WordPress 4.5 with a WooTheme called The Morning After. I decided to change a few things here and there, but encountered some issues regarding the posts_per_page
argument used in the WP_Query
object. The intention is to show more than one post (3 or 4 posts) and ignore the category Featured articles.
$args = array(
'posts_per_page' => 2,
'category__not_in' => get_cat_ID('Featured articles')
);
$query = new WP_Query($args);
while ( $query->have_posts() ) {
$query->the_post();
echo '<li>' . get_the_title() . '</li>';
};
What am I doing wrong? Result is 4 posts including the posts that are in the category Featured articles
.
WP_Query
, i assume that's mistake you have done while asking