If I’m understanding this correctly something along these lines should work.
$authors = array( 1, 2, 3 ); // privileged users array
$signed_in_user = wp_get_current_user(); // get current user
// check if singed in user is in authors array
if ( in_array( $signed_in_user->ID, $authors ) ) {
$query = array(
'posts_per_page' = -1,
'author__in' = $authors
);
}
else {
// alternate query for other users
}
$posts = new WP_Query( $query );
Related Posts:
- author.php with ACF and CPTs
- Query to return maximum of one post per author
- Show only oldest post by author
- Function to check if author has posted within the last x days
- Show one post per author and limit query to 8 posts
- Pagination 404 errors for author posts query on author.php
- Only display authors who have posts
- Get List of all the Authors
- How can I display list of all posts from a specific author, with publish dates in the future, on an author archive page (author.php)?
- Get authors by term id or slug
- Dynamic User Id
- Custom Query by Author field and meta
- slow WP_Query for non-admin user
- WP_Query (list) posts according to author’s custom field
- Exclude some authors from query
- Get author if post has multiple authors
- All posts returned when author of 0 is queried
- Posts in loop all show the same author when there are many authors
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Display if author page is author page of current user
- Exclude authors IDs from WP_Query
- WP_Query author parameter not working
- query post by author gender
- How can i show pagenavi in my author.php?
- wp query to use both author id and meta_query
- Counting instances of words in the results of a post query
- Query posts by post type, author and post meta
- Get authors list and sort them by recent posts
- query all posts published by certain user id
- WP_QUERY with both author and post_type set (makes me crazy)
- Include posts with a specific custom taxonomy term in author page
- When should you use WP_Query vs query_posts() vs get_posts()?
- When to use WP_query(), query_posts() and pre_get_posts
- WP_Query by just the id?
- Meta_query compare operator explanation
- WP_Query with “post_title LIKE ‘something%'”?
- wp query to get child pages of current page
- How to get an array of post data from wp_query result?
- How to get post id of static front page?
- meta_query with meta values as serialize arrays
- How to only display posts whose meta_value field is not empty?
- Get post ids from WP_Query?
- Pagination when using wp_query?
- Exclude post ID from wp_query
- How to print the excuted sql right after its execution
- How to extend WP_Query to include custom table in query?
- How to store and receive variables in WP sessions?
- Should I use Pre Get Posts or WP_Query
- How can i retrieve default post per page value? from settings->reading. And total number of posts?
- Nested meta_query with multiple relation keys
- Is it necessary to use wp_reset_query() in a WP_Query call?
- Can I force WP_Query to return no results?
- Can wp_query return posts meta in a single request?
- Using pre_get_posts with WP_Query
- Find out total number of pages in global query on archive page?
- WP_Query + random
- Resetting post data to previous loop in nested loops
- order by numeric value for meta value
- numberposts? showposts? posts_per_page?
- $GLOBALS[‘wp_the_query’] vs global $wp_query
- Broken? WP_Query and “attachment” as a post type
- Some doubts about how the main query and the custom query works in this custom theme?
- Order by multiple meta key and meta value [closed]
- Post_count only shows the number of results per page
- Page template query with WP_Query
- meta_query ‘compare’ => ‘IN’ not working
- Query posts only with featured image
- Wp get all the sub pages of the parent using wp query
- What is appropriate flow for custom data from URL in WP_Query?
- How to display page content in a page template?
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- How to merge two queries together
- Posts with at least 3 tags of a list of tags
- Get post count of current loop when using multiple queries on one page
- why ignore_sticky_posts in sticky post query
- Wp_redirect and sending variables
- Multiple relationship for multiple tax_query in WP_Query
- How do I get posts that have a thumbnail in WP_Query?
- Multiple WP_Query loops with Pagination
- How do I query for posts by partial meta key?
- Pagination with custom SQL query
- Return only Count from a wp_query request?
- Using a custom WP_Query with get_template_part loop
- Use REGEXP in WP_Query meta_query key
- Why is the loop not empty on some 404s?
- WP_Query orderby post__in remains ineffective in the Loop [closed]
- WP Query Args – Title or Meta Value
- How to query for most viewed posts and show top 5
- WP_Query orderby date not working
- WordPress Pagination Not Working – Always Showing First Pages Content
- Best way to detect if you are in a SINGLE POST page
- Meta query with string starting like pattern
- WP Query where title begins with a specific letter
- WordPress tax_query “and” operator not functioning as desired
- compare meta_query in get_posts arguments
- Custom taxonomy query broken after upgrade to 4.4
- WordPress retrieving meta data for all custom post types in list view
- How to query posts based on lat-lng coordinate as post meta?
- How to use the_posts_navigation for wp_query and get_posts?
- WP_Query vs get_posts