[Plugin: Posts 2 Posts] Querying connections by their fields ?
-
Thank you, scribu, for the work! Now, following my stackexchange question i run into a problem.
I’ve registered this connection:
p2p_register_connection_type( array( 'id' => 'pieces_persons', 'from' => 'piece', 'to' => 'person', 'fields' => array( 'role' => array( 'title' => 'Role', 'values' => array( 'conductor', 'composer', 'soloist' ) ) ) ) );
I’ve created a
piece
, added two persons: oneconductor
and onecomposer
. And I want to get onlyconductor
for current post:$conductor = p2p_type( 'pieces_persons' )->get_connected( get_queried_object_id(), array( 'connected_meta' => array( 'role' => 'conductor' ) ) ); echo count( $conductor->posts );
But this echoes
2
— i get both persons.Please, what’s wrong?
Thanks!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘[Plugin: Posts 2 Posts] Querying connections by their fields ?’ is closed to new replies.