Problem with multiple connexions
-
Hi, I’m using posts 2 posts on some blog I’m working on, and I can’t figure out how to use multiple connections.
I have 2 custom post types (game & subject) that both have the same custome taxonomy (platform)
These post types are linked to the wordpress posts using P2P like this :
function connection_types() { p2p_register_connection_type( array( 'name' => 'posts_games', 'from' => 'post', 'to' => 'games', 'reciprocal' => true, 'duplicate_connections' => true ) ); p2p_register_connection_type( array( 'name' => 'posts_subjects', 'from' => 'post', 'to' => 'subjects', 'reciprocal' => true, 'duplicate_connections' => true ) ); } add_action( 'p2p_init', 'connection_types' );Then on my platform taxonomy page, I have two queries, the first one gets the games and subjects that have the current taxonomy.
Then I’m trying to query all the wordpress posts connected to these with the following query :
$connected = new WP_Query( array( 'post_type' => array('post'), 'connected_type' => array('posts_subjects', 'posts_games'), 'connected_items' => $gameorsubject->get_posts(), 'connected_direction' => 'any', 'nopaging' => false, 'paged' => $paged ) );This query works for some taxonomies, and for some, it doesn’t return any post (it should).
Did I forget anything ? Am I using the plugin like I should ?
Thanks a lot for your helpupdate : i just checked the sql query, and it’s not the same for each taxonomy, how’s that possible ?
The topic ‘Problem with multiple connexions’ is closed to new replies.