Custom Fields
Support MB Relationships Single metabox on Reciprocal Relationship

This topic contains 4 replies, has 4 voices, and was last updated by  Jeremy Carlson 2 months, 1 week ago.

  • Creator
  • #14412

    Content Pilot

    Hi Ahn,

    Until now, I have been using this plugin to relate an object in post type A with an object in post type B. This works great b/c the plugin creates a to and from metabox on each post type edit screen. I am now being ask if we can have a reciprocal relationship between two objects in the same post type. From the initial testing and reading the docs, both the to and from meta are being created. is there any way or do you have an idea of how to get it down to a single metabox when performing this type of relationship. I would be willing to submit a PR on github if we can talk through how this could be accomplished.

    My initial thought was to add a flag in the metabox registration like reciprocal => true and then that disables the default metabox output. Then you can insert the single metabox which is a combination of the two and from objects mashed together somehow. Does that sound like a good approach? What do you think? This is a must have for the platform I am building btw. Really appreciate your time.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #14416

    Anh Tran

    Hi Clayton,

    Thanks a lot for your valuable feedback! I didn’t think about the 2 identical meta boxes appear on both sides (since it still works).

    I like the idea of adding reciprocal => true to the relationship. It’s simple and easy to understand. My additional thought might be we should let users define only one meta box instead of 2. Would you mind helping me on Github?


    Content Pilot

    For sure. I was expecting to be a big part of it. I greatly appreciate you guiding the way. Let’s come up with a strategy and start a branch.



    Hi Anh,

    I suggested a boolean for bi-directional (reciprocal) relationships in this post:

    Hope this helps,


    Jeremy Carlson

    Hi there, I just wanted to check in — has anyone made progress on this concept? I’m working on a project where the relationship is very much reciprocal, and would love to use this.

    In my case, the concept is plants which are “good companions” of each other. If tomatoes are good companions of basil, basil is automatically a good companion of a tomato.

    I’m also considering implementing creating the reciprocal connection programmatically, but not quite sure how to go about that. New to MB.

    Thanks for any input!

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.