i am using the following code in which i exclude specific categories.
$recent = array( 'posts_per_page' => 10, 'cat=-1,-12,-13,-14,-15,-16,-17,-20,-195,-245,-203' ); $recentPosts = new WP_Query($recent); ?> <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?> //code for showing the posts <?php endwhile; ?> <?php wp_reset_query(); ?>
The number of shown posts (10) work fine, i cant make it work the exclusion of the categories…
Its seems really strange. Any sollutions??
I have used the code from here: http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters
Thanks in advance
- The topic ‘WP query not working for categories’ is closed to new replies.