Support Forum
Support › MB Relationships › Switched from Builder to Code and Now Relationship Doesn't ShowResolved
Hello all,
I made a relationship in the builder linking a "Services" CPT to a "Therapists" CPT. Then I decided to add taxonomy to the Services CPT and realized I couldn't use query vars to go that deep in the builder. So I switched to PHP code to make the relationship with taxonomy query vars, but I kept the ID of the relationship the same, and deleted the one I initially made in the Builder.
Now, the relationship doesn't show on the Therapist Edit screens unless I rename the ID of the relationship. How can I find the entries of the old Builder-relationship so I can delete it so that the code version takes over and shows in the edit screen?
I hope I'm making sense.
Better yet, is there a way to make taxonomy query vars in the builder without it parsing the information in PHP with slashes?
Hello,
You can find the relationship in the builder by going to Meta Box > Relationships. Or find the item in the table wp_posts
with post type mb-relationship
.
Regarding your second question, what is the taxonomy query vars in your case?
Sure. What I'm trying to achieve is related to the support you provided here. Except instead of doing it via PHP code, I want to use the tax_query array inside the Builder UI.
However, when I try to put an array inside of the Query Vars field in the Relationships Builder UI, it "sanitizes" the array with slashes, likely to escape the characters being used. I do not want it to sanitize. Unfortunately, there's no sanitization customization in Relationship Builder UI. So I must resort to registering the relationship via PHP code.
Here's what I'm putting in the builder:
https://imgur.com/a/f9xrQzX
Here's the output:
'field' => [
'query_args' => [
'tax_query' => '[ \'taxonomy\' => \'service-types\', \'field\' => \'slug\', \'terms\' => \'concentrations\' ]',
],
The problem I am experiencing with this is compatibility with another plugin, Admin Columns Pro. When registering relationships via PHP code, ACP doesn't integrate the relationship properly and therefore does not provide capabilities to do inline editing via an admin column. When doing it via the MB Builder UI, it does, which is why I want the Builder to stop sanitizing my Query Vars in this relationship.
ignore the <div> tags btw
Hello,
In the builder, you can use the dot notation or JSON notation to pass an array to query args. Read more in the documentation https://docs.metabox.io/extensions/meta-box-builder/#dot-notation
Thank you so much! I looked everywhere for something like this. Clearly I didn't look hard enough. Thanks again!!!