If I understand your question correctly, then it’s a matter of joining the code from two answers from the following Questions of this Stack:
- Changing Top Level Items into Radio Buttons in the Categories Meta Box?
- Make parent categories not selectable
This is the result, top-level categories are converted to radio buttons, so only one can be selected.
The caveat is that sub-categories from other top-level categories can be selected as well.
As I mention in my answer to the second Question, Scribu’s plugin, Category Checklist Tree, is almost a necessity for this scenario.
I’ll not repost the full code, it’s just a matter of replacing this lines:
jQuery("#categorychecklist>li>label input").each(function(){
jQuery(this).hide();
});
For this ones:
jQuery("#genrechecklist>li>label input").each(function(){
this.type="radio";
});
Attention to the ID of the <ul>
:
[Update]
For knowing which category is the “main category”, from all selected parents or children, I can only think of a Custom Field to hold this information.
This could be solved programmatically, creating a new Meta Box, displaying a dropdown list with all categories, and saving this as post meta (update_post_meta
).
And with a plugin, this can be done with Advanced Custom Fields and the Taxonomy Field add-on. Which results in: