wp-posts-to-posts
wp-posts-to-posts copied to clipboard
query on multiple type, not same connected_items
Hello !
Thanks for the great plugins ! I'm using this on all my projects now :)
My situation here, I'm trying to query posts filtering by multiple connection types but not with the same connected_items,
this is what I would like to do :
$query = new WP_Query(array(
'post_type' => 'albums',
'connected' => array(
array(
'connected_type' => 'labels-albums',
'connected_items' => $some_label_id,
),
array(
'connected_type' => 'artistes-albums',
'connected_items' => $some_artist_id,
)
)
));
Is there a way to achieve in a single Query ? because I need pagination and other WP filtering on it...
Thanks !!
Hello, I'm still stuck on this, if anyone has an idea ...
Anyone ?
I haven't tried it but I think I saw in the docs that 'connected_type' can be an array. So instead of
'connected_type' => 'labels-albums',
use
'connected_type' => ['labels-albums','artistes-albums'],
'connected_items' => [$some_label_id,$some_artist_id],
Is there any update on this?
Using some something like what @Jeff-Lewis suggested doesn't seem to have much of an effect.
I'm trying to do this too and haven't had any success so far. @Jeff-Lewis suggestion doesn't work for me either. Has anyone managed to do this?
I know old, but did anyone work out this one? Thanks