Title: [Plugin: Posts 2 Posts] nested relationship condition
Last modified: August 20, 2016

---

# [Plugin: Posts 2 Posts] nested relationship condition

 *  [aaron@rossano.com.au](https://wordpress.org/support/users/aaronrossanocomau/)
 * (@aaronrossanocomau)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-nested-relationship-condition/)
 * hi,
    i have a relationship: venue > event > session.
 * my query gets the venue with a condition for a meta_key and then retrieves all
   the events and sessions.
    then i run a condition through every session if to 
   include the event or not.
 * is it possible to set the get relationship to not get events with a condition
   on the session? or do i already have to get all the events and then set the condition
   on the sessions?
 * so ideally i’d want to get all the venues. then
    get each connected event only
   if the session meta query with date bigger than today.
 * or would it be faster and possible to somehow merge two queries, one for sessions
   and ones for venues. and then when getting the events within the venues one, 
   only if the id is included in my sessions query?
 * at the moment neither is going to have much impact, but when the events database
   grows big, it’ll have to get all the events in the database every time which 
   i would guess be a bit slow.
 * [http://wordpress.org/extend/plugins/posts-to-posts/](http://wordpress.org/extend/plugins/posts-to-posts/)

The topic ‘[Plugin: Posts 2 Posts] nested relationship condition’ 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/)

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [aaron@rossano.com.au](https://wordpress.org/support/users/aaronrossanocomau/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-nested-relationship-condition/)
 * Status: not resolved