Hi!
I have connected content that used to display on post archived using this code from the docs:
global $wp_query, $post;
MB_Relationships_API::each_connected( [
'id' => 'posts_to_pages',
'from' => $wp_query->posts, // 'from' or 'to'.
] );
while ( have_posts() ) : the_post();
// Display connected pages
foreach ( $post->connected as $p ) :
echo $p->post_title;
// More core here...
endforeach;
endwhile;
For some reason, it's not displaying anything anymore.
As you can see, the array is empty:
https://p120.p4.n0.cdn.getcloudapp.com/items/OAu7ol12/8fd9a594-683f-4f19-b3fd-6f611f2fac1e.jpeg?v=2d8ac2c87f929d6af3c63e47838bfef2
But there are two books connected to the series:
https://p120.p4.n0.cdn.getcloudapp.com/items/NQu5WpX7/44c85485-2190-46bb-a6bd-4952397e97ee.jpeg?v=7673360e7887c18b718fa70e1885e0c4
Here is a look at my code:
https://p120.p4.n0.cdn.getcloudapp.com/items/OAu7olDR/6ceb01d9-7613-4bf6-a7cf-773f43e6ed34.jpeg?v=89f28de17188e2a9caceb71f640b32f5
Let me know if you have any idea what is going on and why it suddenly stopped working.
Thanks!