Query Users by post count, last 30 days and display each users post count according to post type

I'm almost done, the code below does everything but display post count for each user broken down into post types, and also I'm like to filter it last thirty days.

I'm trying to get the post for each user fr the custom post type 'music'.

div id="top-artist-wrapper"

?php foreach ( get_users('orderby=post_countnumber=5') as $user ) : ?

div class="top-artists"
?php echo get_avatar($user-ID, '64'); ?

div class="artist-name"
    ?php echo $user-display_name; ? (?php echo count_user_posts( $user-ID, $post_type='music' ); ? Posts)

/div

/div

?php endforeach; ?
/div

What am I missing, is the even the right way to do the query?

Pardon the HTML mixed in.

Topic wp-user-query wp-query users Wordpress

Category Web


count_user_posts() doesn't support the second parameter ($post_type in your code), according to the docs.

There is a function at the bottom of the docs page that allows you do filter by post_type, you could drop in functions.php and use.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.