scribu / wp-posts-to-posts

Efficient many-to-many connections between posts, pages, custom post types, users.
http://wordpress.org/plugins/posts-to-posts/
969 stars 260 forks source link

How to differentiate between duplicate connections #548

Open Pollux321 opened 7 years ago

Pollux321 commented 7 years ago

I'm trying to differentiate between duplicate connections. I make a duplicate connections of two posts on seperate pages that result in seperate p2p_id's but I have no way of differentiating between them when I want to disconnect a specific one or get that connections meta data.

On page 1 I have a connection between post A and post B with connection meta data of 'structure_id' equaling the ID of page 1. I also give the connection the 'date' field and value of time the connection was created.

On page 2 I have another connection between post A and post B that has a different p2p_ID and a different 'structure_id' that is the ID of page 2 along with the date.

What doesn't work...

p2p_type( $connectionName )->disconnect( $postA, $postB, array(
    'structure_id' => $structure_id
));

I need a simple way to use the connection meta to differentiate between duplicate connections when all I have is the connection meta data, connection name, and ID's of the two posts.