I want to query posts by their author role. And do something with the post based on the role.
I know we can get the post by get_posts or WP_query, the problem is there are no argument to sort the post based on the author role. Or, we also can combine get_users and get_posts together, like this
$users = get_users(array(role => 'author'));
foreach($users as $user){
//here we can use get_posts to query the posts by the $user->ID
} .....
this is too clumsy to doing this. I want to know if there any other way to query the posts based on the role, SQL query perhaps?
