Re-Envisioned › Support › Meta Box Conditional Logic › MetaBox doesn't saves and it doesn't work with selected category › Reply To: MetaBox doesn't saves and it doesn't work with selected category
There are several things in this case:
- I see you create 2 groups: 1 group for categories A & B, 1 group for categories C & D. And you put the conditions in each fields of the groups. That’s not good for performance because the plugin has to process all fields. Why don’t we put the conditions for the groups only? So we need only 2 conditions instead of 10?
The value for the category select actually is the category ID, so we have to use IDs instead of category slug or name.
The category select has a field type
checkbox_tree, which means its value is an array. We can’t use operator
=in this case. Instead, use
I have adapted your code and made a fix here (please change the categories’ IDs to match your case):
Here is my test: