1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
/** * Fix compatibility issues with The Event Calendar and Posts 2 Posts WordPress Plugins * Issue arrises with how nested select queries function when P2P expects a single column. */ function tribe_to_p2p_pre_get_posts_20121001( $query ){ if(isset($query->_p2p_capture) && $query->_p2p_capture && ($query->query_vars['eventDisplay'] = 'custom') ) { add_filter( 'posts_fields', 'tribe_to_p2p_setupFields_20121001', 20); } else { remove_filter( 'posts_fields', 'tribe_to_p2p_setupFields_20121001', 20); } return $query; } function tribe_to_p2p_setupFields_20121001( $fields ){ global $wpdb; $fields = "{$wpdb->posts}.ID"; return $fields; } add_action( 'pre_get_posts', 'tribe_to_p2p_pre_get_posts_20121001'); |
References:
http://tri.be/support/forums/topic/posts-2-posts-connections/