php – Count the number of custom posts per user

Question

I am using JetEngine, and the users can create CCTs (custom content types), that have a single post CPT

I know already how to count the number of posts by the user, I am using shortcode for that

function total_user_post_shortcode() {
$current_user = wp_get_current_user();
if ( 0 != $current_user->ID ) {
echo $user_post_count = count_user_posts( $current_user->ID );

}
}

add_shortcode(‘total-user-posts’, ‘total_user_post_shortcode’);

But I want to specify just a certain type of custom post, not all of them.

How should I change the code?

Thanks

0
DaveyBear 1 year 2022-06-16T08:58:40-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse