I want to display Y number of authors' info randomly. These authors have to have at least X numbers of posts published.
Please keep in mind that this would be for a blog with thousands of users where most of them have published 0 posts.
I have looked at functions like
WP_User_Query() but I cant seem to be able to set the minimum number of posts each author needs to have.
I have tried to get the authors with those functions and then, with a loop, test for each author id and see if they have posted X number of posts or more. (I want to avoid this because it seems too tedious and might be too poor performance wise.
I could order them in descending order, shuffle the array and display the users' info, but I do not want this because I prefer to showcase users with low number of posts.
If I order them in ascending order, I would get hundrends or thousands of users with 0 posts. However, here I can use
wp_list_authors() as indicated by @s_ha_dum in: Total number of authors with more than one post that excludes authors with 0 posts but what if I want to get users that have at least 2 or more posts?
Finally, I could use a
pre_user_query filter as explained by @helgatheviking in: WP_User_Query to exclude users with no posts
Is this the best solution?What about performance? Is there a better solution? If so, what would you recommend me do?