• Resolved Jacorre

    (@jacorre)


    I’m using a plugin to count the total number of published posts using the following:

    $numposts = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_type = ‘post'”);
    if (0 < $numposts) $numposts = number_format($numposts);
    echo $numposts;

    I’d like to exclude a specific category so it won’t be counted. I tried adding:

    AND post_category != ‘3’

    But that did not work. Am I using the wrong thing or does it need to written completely different?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display number of posts excluding specific category’ is closed to new replies.