- This topic has 1 reply, 1 voice, and was last updated 1 year, 3 months ago by .
-
Topic
-
I have two post types: ‘Conversation’ and ‘Person’.
When creating a Conversation, a user can select people to be related to the Conversation.
I created the relationship like this:add_action( 'mb_relationships_init', function() { MB_Relationships_API::register( array( 'id' => 'connect_conversations_to_people', 'from' => 'conversation', 'to' => 'person', ) ); } );
This works: the user can indeed select People when creating a Conversation post.
In the Page Template for displaying the Conversation, I want to display the People who are related to the Conversation. I’ve basically copied code from the documentation for MB Relationships:
$connected = new WP_Query( array( 'relationship' => array( 'id' => 'posts_to_pages', 'from' => get_the_ID(), // You can pass object ID or full object ), 'nopaging' => true, ) ); while ( $connected->have_posts() ) : $connected->the_post(); ?> <a>"><?php the_title(); ?></a> <?php endwhile; wp_reset_postdata();
This yields the fatal error:
Fatal error: Uncaught Error: Call to a member function get_db_field() on null in /var/www/mysite.localdev/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-relationships/inc/query/normalizer.php on line 75
What could be happening here?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.