You can run a query using get_posts
to retrieve posts from a specific author, and exclude certain categories, and then use count
to return the amount of posts. get_posts
uses the same parameters as WP_Query
, so you can have a look at the parameters there
<?php
$args = array(
'author' => 1 //ID of the author
'posts_per_page' => -1, //Retrieve all posts
'category' => -13, // Category to exclude, must be ID, as category is passed to WP_Query as cat
);
$posts_array = get_posts( $args );
echo count($posts_array); //Display post count