What you can do is the following:
http://codex.wordpress.org/Function_Reference/get_posts_by_author_sql
<?php
$where = get_posts_by_author_sql( 'post', true, $user->ID);
// get post query
global $wpdb;
$query = "SELECT ID FROM $wpdb->posts $where";
$post_ids = $wpdb->get_var( $wpdb->prepare( $query, 'Get all posts' ) );
?>
Did not try it but something simular in your case should help.
Related Posts:
- Should we trust the post globals?
- WordPress Number of Posts Not Changing With posts_per_page
- Looping through posts per category gives same posts for each category
- How to setup a query to output posts by groups of five?
- Exclude current custom post on single post
- First x post with another template then the others
- WordPress loop not working on static front page
- Some doubts about how the loop work (trying debugging it)
- Get current taxonomy and display query accordingly
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- Advanced Post Display/Pagination/Ordering
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Grab next post title in archive page
- Query *only* sticky posts
- Can’t show comments count per post outside loop
- Alternate custom content in the loop
- wp_enqueue_media() slows down my WP site
- How can I get all posts data from within a paginated search result?
- Auto Refresh Post List after X seconds
- Query posts from different categories in multisite
- Display posts with comments closed, with pagination?
- posts_per_page doesnt work
- Only display posts after current date
- WP_Query Authors OR Categories
- How to display posts on a static page? (like search loop)
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Most liked page not displaying posts
- WordPress Loop – Next 3 Posts
- Blog page pagination is not working after using the offset argument
- More then one menu items are assigned with “current-menu-item” class
- Pulling in post category and children within category
- get query() without post content?
- How can I setup a relationship using categories in WordPress?
- posts_per_page option limits the number of Gallery items
- How to exclude visited posts from loop
- Dynamically switch template on click
- add to end of post in the loop with plugin
- Get all custom post types excepted some…
- Get all comments of author’s posts
- Do not show children of a category
- Custom taxonomy archive page problem
- post__in not working with pre_get_posts, but post__not_in does work
- Query posts and filter at query time by value of custom meta
- Add custom text automatically on each post
- Delete post revisions only for a single post
- Display current post position in Elementor Posts widget
- How to give classname to post if post has no content?
- How to retrieve certain number of images from a wordpress post?
- Not all posts showing in query
- If custom field is empty, use one from a previous post
- Get post category as a separate string and url
- I can’t find the relevant part of the loop in my theme file. How do I find the full content with “More…”
- How to separate each individual blog post?
- How to show full post on home page
- Trying to exclude custom posts based on date, while sorting by custom field
- Is there a way to define the $post var outside the loop?
- ACF flexible content block not showing on live site (works locally)
- Only the most recent post is showing on my category page (working on localhost, not live site)
- How to optimize posts query in wordpress
- Query to fetch custom taxonomy along with post title
- How to search through “post title” and “tags” using WP_Query?
- How to show post views shortcode data for each post on Posts List Page?
- I have two post types in the same query, how can I use CSS to select only one post type?
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- Show 5 posts and than 3 posts offset with pagination
- How to show category image if no featured image is set?
- Get post id outside loop : Notice: Trying to get property of non-object
- Retrieve posts inside foundation tabs and tab-content split by 3 per row
- Can I Paginate Post after every 25 tag?
- Post being duplicated with foreach loop
- Numbering author posts in posts query
- Alternative content between posts no repetition
- Start loop from specific post ID
- How to run select query of post with category and tags?
- Display new posts categories in separated divs
- Query posts from newest category
- Custom post type – Loop out in random order but same 15 to appear first… still random
- WordPress infinite post cycle
- WordPress Request Post All Post ID in a Loop? [closed]
- WordPress loop uses unmodified posts array, why?
- Add row after three columns
- Post Format problem
- Custom Select Query pagination not working properly
- Sort / Filter Queries
- Skip posts, but keep posts per page
- index.php is only displaying current month’s posts?
- Ordering posts alphabetically by meta keys and title
- Loop doesn’t display posts. It displays a link to the home page instead
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Continuous listing from a custom field
- Getting posts from multiple users?
- Show post if in category
- Displaying categories items among posts
- How to store post rating system data post independent?
- Related posts by searching post tags of single post as terms
- Show all posts in category
- First post in loop displays twice
- Wrap every 2 posts
- What function does the loop of displaying posts?
- I am using the query block and what I want and see on the editor page is not the same with the actual results