$post_author = 1; //author id
$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = $post_author AND post_type IN ('post','page','book') and post_status = 'publish'" );
echo 'count of post types post,page,book for user id 1: '.$count
Can you just tell me how to use that code without have to define the author ID? I mean… it’s a multiauthor blog, so it should retrieve the post count of the specific author of the post, which obviously is not always the same one.
Again, thanks for your help!
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘the_author_posts(); not counting custom post types’ is closed to new replies.