<?php // get author ID $author_id = get_the_author_meta( 'ID' ); // echo count for post type (post and book) echo count_user_posts( $author_id , ['post','book'] ); ?>