true ) ); ?> 5, 'fields' => array( 'ID', 'display_name' ), 'role__not_in' => 'Subscriber', ) ); $users = $users_query->get_results(); foreach ( $users as $data => $user ) { $users_id = $user->ID; if ( user_can( $users_id, 'publish_posts' ) ) { $users_name = $user->display_name; $post_types_count = array( 'attachment' => 0, 'post' => 0, 'page' => 0, 'other' => 0, 'total' => 0, ); $attachment_query = new WP_Query( array( 'post_type' => 'attachment', 'post_status' => 'inherit', 'author' => $users_id, 'fields' => 'ids', 'nopaging' => true, ) ); $post_types_count['attachment'] = $attachment_query->found_posts; $post_types_count['total'] += $attachment_query->found_posts; foreach ( $post_types as $key => $pt_name ) { if ( 'attachment' !== $pt_name ) { if ( 'page' !== $pt_name && 'post' !== $pt_name ) { $post_count = count_user_posts( $users_id, $pt_name ); $post_types_count['other'] += $post_count; $post_types_count['total'] += $post_count; } else { $post_count = count_user_posts( $users_id, $pt_name ); $post_types_count[ $pt_name ] = $post_count; $post_types_count['total'] += $post_count; } } } ?> $value ) : ?>
See all