I’m using Posts 2 Posts plugin. I’ve got 2 custom types : movies and actors. I created a movie => actor connection so that for each movie I can see which actors play in.

But as far as I understand, in order to find out all the movies a particular actor has played in, you must create an actor => movie connection AS WELL.

So if create a The Dark Knight => Christian Bale connection, I MUST create a Christian Bale => The Dark Knight as well. Because otherwise I won’t be able to know that Christian Bale played in that movie based on a “Christian Bale” search.

Is that correct ? If so, is there any way to make it less burdensome ?

2 Answers
2

To see connections on both edit screens, set reciprocal to true, but note this is for the UI only, it doesn’t affect connections otherwise.

function my_connection_types() {
    if ( !function_exists( 'p2p_register_connection_type' ) )
        return;

    p2p_register_connection_type( array( 
        'from' => 'movies',
        'to' => 'actors',
        'reciprocal' => true
    ) );
}
add_action( 'init', 'my_connection_types', 100 );

Leave a Reply

Your email address will not be published. Required fields are marked *