Empty list of connections in version 1.6.2
-
I’m having a problem where connections that I create between instances of two custom post types (
abc_person
andabc_animal
) show up fine in the admin interface, but not when I try to retrieve and render them on the archive pages for the custom post types.I am registering as follows:
p2p_register_connection_type(array( 'name' => 'persons_to_animals', 'from' => 'abc_person', 'to' => 'abc_animal', 'cardinality' => 'one-to-many', 'sortable' => 'any' ));
Then I create connections, which show up as expected in the WP admin interface.
But then, on the
archive-abc_person
template, regardless of whether I use$connected = get_posts(array( 'connected_items' => $wp_query->posts, 'connected_type' => 'persons_to_animals', 'connected_direction' => 'from', 'nopaging' => true, 'suppress_filters' => false )); p2p_distribute_connected($wp_query->posts, $connected, 'connected'); if (have_posts()) : while (have_posts()) : the_post(); ...etc...
or
p2p_type('persons_to_animals')->each_connected($wp_query); if (have_posts()) : while (have_posts()) : the_post(); ...etc...
I always receive an empty array back as
$post->connected
The archive template is otherwise plain and doesn’t have any other relevant code in it that would affect the loop.
What am I doing wrong?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Empty list of connections in version 1.6.2’ is closed to new replies.