Title: [Plugin: Posts 2 Posts] Display posts only to associated users
Last modified: August 20, 2016

---

# [Plugin: Posts 2 Posts] Display posts only to associated users

 *  Resolved [David Wang](https://wordpress.org/support/users/blogjunkie/)
 * (@blogjunkie)
 * [14 years ago](https://wordpress.org/support/topic/plugin-posts-2-posts-display-posts-only-to-associated-users/)
 * I’m using [Posts 2 Users](https://github.com/scribu/wp-posts-to-posts/wiki/Posts-2-Users)
   to associate one or more users to a post and a custom post type called ‘proposal’.
 * Now on the index and archive pages, I only want to display the posts associated
   to that user i.e. the user is not able to see a post if it has not been associated
   with him.
 * I’ve had a look through the documentation but I don’t see anything that shows
   me how to filter the loop according to the currently logged in user. Can Posts
   2 Posts do what I want?
 * Thanks
 * [http://wordpress.org/extend/plugins/posts-to-posts/](http://wordpress.org/extend/plugins/posts-to-posts/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years ago](https://wordpress.org/support/topic/plugin-posts-2-posts-display-posts-only-to-associated-users/#post-2731148)
 * Yep, you can use the ‘parse_query’ action:
 *     ```
       function filter_viewable_posts( $wp_query ) {
         if ( ! $wp_query->is_main_query() )
           return;
   
         $wp_query->set( 'connected_type', 'YOUR_CONNECTION_TYPE' );
         $wp_query->set( 'connected_items', get_current_user_id() );
       }
       add_action( 'parse_query', 'filter_viewable_posts' );
       ```
   
 *  Thread Starter [David Wang](https://wordpress.org/support/users/blogjunkie/)
 * (@blogjunkie)
 * [14 years ago](https://wordpress.org/support/topic/plugin-posts-2-posts-display-posts-only-to-associated-users/#post-2731155)
 * Thanks scribu, that gives me something to work on 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: Posts 2 Posts] Display posts only to associated users’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/posts-to-posts_7a8e9d.svg)
 * [Posts 2 Posts](https://wordpress.org/plugins/posts-to-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/posts-to-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/posts-to-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/posts-to-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/posts-to-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/posts-to-posts/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [David Wang](https://wordpress.org/support/users/blogjunkie/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/plugin-posts-2-posts-display-posts-only-to-associated-users/#post-2731155)
 * Status: resolved