Its possible with an ugly custom query but to save your self a lot of time an easier solution would be to add a custom field to each post with the user role , then your query would be much smoother for example say you have a custom field named `u_role’ then your query should look like this:
$news = new WP_Query( array(
'author' => implode( ',', $friend_ids ),
'post_type' => 'news',
'paged' => get_query_var('paged'),
'meta_key' => 'u_role',
'orderby' => 'meta_value',
'order' => 'DESC') );
Related Posts:
- Hide posts from users with a specific role
- How to order posts by custom WP role?
- How to hide post content/meta from everyone except the post author and admin
- SQL User Query by Multiple Roles using PHP
- How to display user order by role
- How can I query users by custom role?
- Why does get_posts only show results for Admins or logged-out users?
- Show menus to one admin username
- Link Author URL’s based on a custom field
- Meta query orderby meta_value_num sorting by role first
- Set “editor” role to existing user
- Pre_get_posts only show posts by administrator roles
- WP_Query: Query posts only if their access is restricted to logged user’s role
- Displaying content to search engines but via navigation only for registered users.
- Get users query makes the site loading time too big?
- How to know which editor published a post programmatically?
- Way to include posts both with & without certain meta_key in args for wp_query?
- How to Access Global $multipage or Global $numpages outside the loop?
- How can I use WP-CLI commands without –allow-root
- Calling a wp_query $posts causes a 500 error
- Merging a complex query with post_rewind and splitting posts into two columns
- ‘posts_where’ filter not applying ‘WP_Query’ in `wp_ajax`
- meta_query not working properly
- Filter wp_query to search post title in function
- Two queries on the same page with pagination
- Using tax_query reverses my post_type argument in a custom WP_Query
- Best approach to create Hot and Trending sections
- creating wp query with posts with specific category
- $wp_query->current_post restarts from zero on paged pages
- get complex results set according to category structure
- wp_get_post_terms of cpt but not duplicates if they are used more than once in the loop
- Setup of taxonomy term template pages
- Ignore post by meta value in the main query
- Display posts in 3 days chunk
- WP_Query’s “request” SQL Query
- How to do a query on custom taxonomies that is uncategorised?
- Order taxonomy terms in alphabetical order
- is_search was called incorrectly
- Empty tax_query array returns an empty array
- Sorting By Custom Posts With Attachments
- How to use WP_Query without breaking the main Query
- Trouble with wp_reset_postdata() in Admin Panel
- only delete post within query / for each statement (front end)
- Database Queries Optimization with new WP_Query
- query_vars filter not working even though query string parameter is present
- How to optimize multiple WP_Query() calls on one page?
- Mysql query and order meta value
- How to make “Blog pages show at most” setting not affect custom queries
- Bypass “supress_filters” in WP Query
- meta_query BETWEEN, but the range is stored in the custom field
- Having trouble with WooCommerce Storefront child theme single.php “related posts” modification [closed]
- WordPress pagination not working on template search.php
- Order ascending is ignored in meta query?
- Custom Pagination in Shortcode with WP_Query
- WP Query – Post Thumbnail
- How to change main query to only query posts from a single category? [duplicate]
- Pagination for blog posts reloading same page [closed]
- Individual months in WP Query
- Show posts by author of membership level (Paid Membership Pro)
- Combine 2 WP_queries into one (OR relation)
- One WP_Query that always shows 1 post from category X and 1 post from “not in category X”?
- embedding shortcodes in php template
- Get posts with no tags?
- get_posts query matches too many results
- Sort by custom field that is an array?
- wp-query, pull children of parent page
- How to change tag based on metabox value within $wp_query
- What’s missing in this wp_query and meta_query
- Tax Query on product_cat using NOT IN as operator does not exclude that category
- How to use the Term Object from a custom select field in a query
- Random users always showing same 8 users
- meta_query order by date present -> future then show null
- whether a nonce is required for get type and get_query_var?
- Wp-query and column blocks
- How to query for exact string in custom field?
- Multi line of $wpdb->query just run 1 time and end the loop right after
- Sort posts on custom field AND after that sort on date?
- Get last child of given page by ID
- How to query users by post count no less than 10
- display the children of the post using the current page as the main parent
- Display 3 levels of categories on page
- Showing most popular post of week
- In Product Category archives how to show Posts having same/similar prod_cat slug structure?
- Custom Theme Building & Permalinks
- previous_posts_link not working in WordPress pagination
- Eliminate typical pages on search page, turn it into ajax search with “infinite” sized single page
- The sorting of posts by a meta_query with two keys fails while separated as single queries it works
- Hierarchical List Pages as a table
- WP_Query with several meta_query-statements and order by meta_value
- query_posts, oderby meta_value & print “future” posts
- Second wp_query doesn’t appear to be working
- difference between methods of query
- post__in not recognizing multiple IDs
- Why does WP_Query not search for two ‘meta_query’ keys separated with OR?
- How do I split a large query with a semi-expensive function included into multiple smaller queries
- Custom WP_query in Jnews theme returns thousands of posts
- wp_query loop with compare operator simply not working, why?
- I want to place a post before all others from an ACF boleen field
- How to put posts with some taxonomy on top of others in `pre_get_posts`
- wp_query, calculate with two dates when ‘key’ is text format