register relationship doesn't work with from/to arrays

Support MB Relationships register relationship doesn't work with from/to arrays

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36467
    ecurtainecurtain
    Participant

    This works:

        MB_Relationships_API::register( array(
            'id'   => 'recipes_to_products',        
            'from' => 'recipe',
            'to'   => 'product',
        ) );

    This does not work:

        MB_Relationships_API::register( array(
            'id'   => 'recipes_to_products',        
        	'from' => [
            	'object_type'  => 'recipe',
        	],
            'to'   => 'product',
        ) );

    I was hoping to use the admin_column parameter for the relationship, but that requires the latter option, which doesn't appear to work.

    Any suggestions? Thanks!

    #36490
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The object type should be post, term, user and recipe should be assigned to the post_type setting

        MB_Relationships_API::register( array(
            'id'   => 'recipes_to_products',        
        	'from' => [
            	'object_type'  => 'post',
                'post_type'    => 'recipe',
        	],
            'to'   => 'product',
        ) );
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.