Order users by number of posts

Question

Im trying to order by post_count DESC but custom_post_type not working

function post_count_type($role, $number) {
$args = array(
    'post_type'     => array( 'custom_post_type' ),
    'orderby'       => 'post_count',
    'order'         => 'DESC',
    'role'          => $role,
    'number'        => $number
);
$users = get_users( $args );
$the_query = new WP_Query( $args );
    foreach ($users as $user) {
    echo 'html here...';
    }}

My function work for post_type : POST but not for custom post_type.
Sorry for my english.

0
mems 4 years 2019-11-03T15:26:06-05:00 0 Answers 80 views 0

Leave an answer

Browse
Browse