I basically want to replace the default taxonomy metabox (with the checkboxes) for my custom post type. I've added the basic code of the metabox below.
The problem I'm having is that I love the idea of the "field_type" => "select_tree" setting, but it seems to have some limitations.
Am I correct that...
- this overrides the
"context" => "side"
and always shows as "context" => "normal"
so it ends up below the content textarea instead of to the right side of it?
- even though it is documented to have multi select enabled, this is not the case and only one parent / child term can be selected?
Note that for select_tree, checkbox_list, checkbox_tree, the multiple setting is always set to true.
Example code:
$metaboxes[] = array(
'id' => 'my_product-info',
'title' => __('Product information', 'my-textdomain' ),
'post_types' => 'my_product',
'context' => 'side',
'fields' => array(
array(
'name' => __('Product Category', 'my-textdomain'),
'id' => 'taxonomy',
'type' => 'taxonomy',
'taxonomy' => 'product_cat',
'field_type' => 'select_tree',
),
)
);
Result: