Title: get_posts is not filtered
Last modified: August 30, 2016

---

# get_posts is not filtered

 *  Resolved [Thubten](https://wordpress.org/support/users/thubten/)
 * (@thubten)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/get_posts-is-not-filtered/)
 * Hello,
 * For some compatibility in my theme, the **get_posts** function is used instead
   of WP_Query to list posts. I found that WP_Query is well filtered by groups but
   get_posts not…
 * Is there a way to filter posts from get_posts function in the same way as the
   WP_Query function ?
 * Thanks in advance.

Viewing 1 replies (of 1 total)

 *  Thread Starter [Thubten](https://wordpress.org/support/users/thubten/)
 * (@thubten)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/get_posts-is-not-filtered/#post-6385325)
 * Hello,
 * For the moment, the solution would be using the **groups API**:
 *     ```
       $queryProducts = get_posts(array('post_type'=> post, 'post_status'=> 'publish', 'showposts' => 1000));
   
       $user_ID = get_current_user_id();
   
       foreach ($queryProducts as $post) {
       	if (!Groups_Post_Access::user_can_read_post($post->ID, $user_ID)) continue;
   
       	$title 		=	get_the_title($post);
       	....
       }
       ```
   
 * Yours

Viewing 1 replies (of 1 total)

The topic ‘get_posts is not filtered’ is closed to new replies.

 * ![](https://ps.w.org/groups/assets/icon-256x256.png?rev=983146)
 * [Groups](https://wordpress.org/plugins/groups/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/groups/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/groups/)
 * [Active Topics](https://wordpress.org/support/plugin/groups/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/groups/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/groups/reviews/)

## Tags

 * [get_posts](https://wordpress.org/support/topic-tag/get_posts/)

 * 1 reply
 * 1 participant
 * Last reply from: [Thubten](https://wordpress.org/support/users/thubten/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/get_posts-is-not-filtered/#post-6385325)
 * Status: resolved