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

array of connection types for query variable 'connected_type' doesn't work as expected. #568

Open
youngmicroserf opened this issue Sep 27, 2019 · 0 comments

Comments

@youngmicroserf
Copy link

youngmicroserf commented Sep 27, 2019

Contrary to the suggestion in the documentation, the connections don't appear to work correctly when an array of connection types is given as parameter for the query. In my case both connection queries work correctly when given individually (two connections involving custom post types), but when given jointly as an array, the quey fails to output the respective connected posts - it does still count them directly though (as per dumped output).

Registered as:

p2p_register_connection_type( array( 'name' => 'a_to_o', 'from' => 'a', 'to' => 'o', 'reciprocal' => true ) );

p2p_register_connection_type( array( 'name' => 'v_to_o', 'from' => 'v', 'to' => 'o', 'reciprocal' => true ) );

and queried as follows:

$connected = new WP_Query ( array( 'connected_type' => array( 'a_to_o', 'v_to_o' ), 'connected_items' => get_queried_object(), 'nopaging' => true, ) );

As mentioned when using either 'a_to_o' or 'v_to_o' sepearately as queried connection type, this works as expected. Using the above array, it does not.

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

1 participant