users post count

The count_user_posts accepts array as the $post_type arguments. You don’t need to include the $post_type = part. $user_posts = count_user_posts( $userid, array(‘post’,’blog’,’lettura’,’intervista’) ); The $user_posts variable will hold the number of posts for the $userid.

get_query_var(‘paged’) return 0 in custom category page

All of your code can be eliminated by using a pre_get_posts filter: function marco_custom_category_filter( $query ) { // only run this on the main query on category archives if ( is_admin() || ! $query->is_main_query() || ! $query->is_category() ) { return; } $query->set( ‘posts_per_page’, 2 ); $query->set( ‘posts_type’, ‘readings’ ); } add_action( ‘pre_get_posts’, ‘marco_custom_category_filter’ ); With … Read more