posts2posts query using connected_items array issue [closed]

Ah I think I understand. I think what you should do with your first loop, is get the connected genres as you say. Then you wish to get all events that are related to those, so you should gather only the IDs (collect them in one array) in a loop, and then use array_unique() to remove all the duplicates. Use this clean array in a loop to get just those posts then. Make sense?

So, something like this might work:

$args = array(
        'connected_type' => 'genres_to_events',
        'connected_items' => array(1240,1241,1242),
        'post_status' => 'publish',
        'posts_per_page' => -1,
    );

$query = new WP_Query($args);

$connected_out = array();

while($query->have_posts()) : $query->the_post();
    $connected_out[] = $post->ID;
endwhile;

$connected_out = array_unique($connected_out);
wp_reset_query();

$args = array(
    'post__in' => $connected_out;
);

$query = new WP_Query($args);
// go!