Get current user post count ( custom post type ‘tourism’)
-
I’m trying to get the current user post count ( custom post type ‘tourism’ )
// Add Shortcode function total_post_count() { $current_user = wp_get_current_user(); if ( 0 == $current_user->ID ) { // Not logged in. } else { echo count_user_posts( $current_user->ID ); } } add_shortcode( 'total_post_c', 'total_post_count' );
how can I specify the custom post type. I also tried
echo count_user_posts( $current_user->ID, ‘tourism’ );
please give me the solution
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Get current user post count ( custom post type ‘tourism’)’ is closed to new replies.