Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query on multiple type, not same connected_items #437

Open
vwasteels opened this issue Apr 30, 2014 · 6 comments
Open

query on multiple type, not same connected_items #437

vwasteels opened this issue Apr 30, 2014 · 6 comments

Comments

@vwasteels
Copy link

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 !!

@vwasteels
Copy link
Author

Hello, I'm still stuck on this, if anyone has an idea ...

@vwasteels
Copy link
Author

Anyone ?

@Jeff-Lewis
Copy link

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],

@adrianfalleiro
Copy link

Is there any update on this?

Using some something like what @Jeff-Lewis suggested doesn't seem to have much of an effect.

@AlchemyCompSol
Copy link

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?

@ejntaylor
Copy link

I know old, but did anyone work out this one? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants