Posted on Leave a comment

Filtering WordPress Feeds

If you are using Groups by @itthinx and you need to filter the feeds, this code can help you:

function my_feed_filter ( $query ) {
  $include = array();  
  if ( $query->is_feed ) {
    $posts = Groups_Post_Access::the_posts(get_posts(array('posts_per_page'=>-1)), $query );
    foreach ($posts as $post)  {
      $include[] = $post->ID;
    }
    $query->set('post__in', $include);
  }
}
add_filter( 'pre_get_posts', 'my_feed_filter' );

Good luck !

Leave a Reply

Your email address will not be published. Required fields are marked *