Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Count posts excluding certain categories Reply To: Count posts excluding certain categories

#194730
poorpaddy
Participant

I figured it out. Just needed to add 'cat' => '-71,-72,-73' to the $args.

<?php
$count_posts = wp_count_posts('sponsors');
$published_posts = $count_posts->publish;
$count = $published_posts/7;
$args = array(
'posts_per_page' => -1,
'post_type' => 'sponsors',
'cat' => '-71,-72,-73'
);
query_posts($args);
?>