Custom Fields
Re-Envisioned
Support MB Relationships Can’t save more of 10 Relationships from Admin

  • Creator
    Topic
  • #21076
    Resolved RijaRatinahirana
    Participant

    Hello,

    I have a relationship set up between a custom post type and users :

       // Add Att Group / Host User Relationship
        MB_Relationships_API::register([
            'id' => 'att_group_host_to_user',
            'from' => [
                'object_type' => 'post',
                'post_type' => 'ot-att-group',
                'meta_box' => [
                    'title' => 'Host',
                    'context' => 'normal',
                ],
            ],
            'to' => [
                'object_type' => 'user',
                'meta_box' => [
                    'title' => 'Host of Groups',
                    'context' => 'normal',
                ],
            ],
        ]);

    If I add more than 10 users to the post using the cloneable dropdowns, only 10 are saved, the others are there but are shown empty.

    Admin Screenshot

    Any clues what is going on ?

    Many thanks 🙂

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #21080
    Long Nguyen
    Moderator

    Hi,

    By default, the object type user shows 10 items if you want to change the number, please use the setting query_args

    MB_Relationships_API::register([
        'id' => 'att_group_host_to_user',
        'from' => [
            'object_type' => 'post',
            'post_type' => 'ot-att-group',
            'meta_box' => [
                'title' => 'Host',
                'context' => 'normal',
            ],
        ],
        'to' => [
            'object_type' => 'user',
            'meta_box' => [
                'title' => 'Host of Groups',
                'context' => 'normal',
            ],
            'field' => [
                'query_args' => [
                    'number' => 15 // This
                ]
            ]
        ],
    ]);

    For more information, please follow the documentation https://docs.metabox.io/extensions/mb-relationships/#syntax.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.