Getting all connected posts across multiple registered connections
Hey all,
I'm looking to create a "stream" of connected information that is time-ordered. I have a custom post_type that I've connected to two other posts with two separate connections. Would it be possible to get both sets of related posts in a single call? If not, any suggestions for merging the two queries?
Thank you,
Nic
When you say "two separate connections", do you mean "two separate connection types"?
Yes, my apologies!
I'm still getting familiar with the ins and outs of WordPress, but I was able to get what I'm looking for through a SQL statement (hoping not to use this, was mostly to see how the connections work):
SELECT *
FROM scuwp.wp_posts, scuwp.wp_p2p
WHERE scuwp.wp_posts.ID = scuwp.wp_p2p.p2p_to and scuwp.wp_p2p.p2p_from = $post_id;
If there's a more elegant way to do this, I'm all ears.
You could just pass the connection types as an array:
new WP_Query( array(
'connected_type' => array( 'C_TYPE_A', 'C_TYPE_B' )
...
) );