Posts 2 Posts retrieving all records in connected table when no match
-
I have three custom post types I’m working with that use Posts 2 Posts: Songs, Albums, and Projects – where a given Song can be connected to an Album and/or a Project.
I am registering the connections like so:
p2p_register_connection_type(‘song’, ‘album’, ‘Songs To Albums’, true);
p2p_register_connection_type(‘song’, ‘project’, ‘Songs To Projects’, true);On the Album pages, I am using the following call:
p2p_get_connected($post->ID, ‘to’);As expected, this returns a list of all Songs connected to the Album.
On the Project pages, using the same call, I only get a list of Songs connected to the Project if there are Songs assigned to the Project. If I’m looking at a Project page that has no Songs connected, p2p_get_connected returns a list of all Songs in the posts table.
Any ideas what I’m doing wrong?
- The topic ‘Posts 2 Posts retrieving all records in connected table when no match’ is closed to new replies.