Relationship 'Post' edit screen even if 'post_type' => 'product' only

Support MB Relationships Relationship 'Post' edit screen even if 'post_type' => 'product' onlyResolved

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #13350
    andrewrhyandandrewrhyand
    Participant

    When register this relationship shouldn't setting 'post_type' => 'product' in the 'to' make it so that meta box only appear for the product cpt?

    For some reason the 'Saves' meta box also appears on the normal post edit screen as well.

    MB_Relationships_API::register([
        'id' => 'users_to_products',
        'from' => [
            'object_type' => 'user',
            'meta_box' => [
                'title' => 'Saves',
                'field_title' => 'Select Products',
            ],
        ],
        'to' => [
            'object_type' => 'post',
            'post_type' => 'product',
            'meta_box' => [
                'title' => 'Saved By',
                'context' => 'side',
                'empty_message' => 'No users',
            ],
        ],
    ]);
    #13627
    Matthias NettekovenMatthias Nettekoven
    Participant

    Hi,

    having the same issue. Were you able to solve this?

    #13634
    Anh TranAnh Tran
    Keymaster

    Hi guys,

    I guess this problem occur because the MB User Meta plugin is not active. It's required to make relationship from "user". Can you please check that?

    #13640
    Matthias NettekovenMatthias Nettekoven
    Participant

    Hi,

    I'm not using the user relations at all.

    I'm just having relations between post custom terms and custom post types. Which I assume is the reason for the behavior.

    So I have custom taxonomy which I added to "Posts". Since I need the same taxonomy all over different Custom Post Types, I made a relation between them. Example:

    MB_Relationships_API::register( array(
                'id'   => 'events_to_units',
                'from' => array(
                    'object_type' => 'term',
                    'taxonomy'    => 'units'
                ),
                'to'   => array(
                    'post_type' => 'events',
                    'meta_box' => array(
                        'title' => 'Add Unit'
                    )
                ),
            ) );

    Now there is a select "Event" Relation Meta box below each post. But I never added a relation between post and CPT.

    Hope that helps to understand my issue.

    #13650
    Anh TranAnh Tran
    Keymaster

    Hi Matthias,

    Did you activate the MB Term Meta extension? It's required to set relationships with terms.

    #13712
    Matthias NettekovenMatthias Nettekoven
    Participant

    Hi,

    thanks that was it 🙂 Appreciate your help.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.