Support Forum
Hi, Im having an issue with taxonomy_advanced and select_tree. Seems like the data is being saved however when viewing the meta box after save the lower level tree values are not being displayed. I checked this issue and it seems like data is being saved as a:1:{i:0;s:7:"82,,431";}
Hi there,
Can you give me the code you use to register meta box?
i have meta box columns plugin installed.
add_filter( 'rwmb_meta_boxes', 'wba_restrictions_meta_boxes' );
function wba_restrictions_meta_boxes( $meta_boxes ) {
$prefix = WBA_MB_PREFIX;
$countries = new WC_Countries();
$states = $countries->get_states('US');
// 1st meta box
$meta_boxes[] = array(
'id' => 'restriction_targeting',
'title' => esc_html__( 'Targeting', 'your-prefix' ),
'post_types' => array( 'restrictions' ),
// List of meta fields
'fields' => array(
array(
'name' => esc_html__( 'States', 'your-prefix' ),
'desc' => esc_html__( 'Target specific states in this rule.', 'your-prefix' ),
'id' => $prefix . 'states',
'type' => 'select_advanced',
'multiple' => true,
'options' => $states,
//'columns' => 6
),
array(
'name' => esc_html__( 'Cities', 'your-prefix' ),
'id' => $prefix . 'cities',
'type' => 'post',
'post_type' => 'cities',
'field_type' => 'select_advanced',
'multiple' => true,
'placeholder' => esc_html__( 'Select one or more cities', 'your-prefix' ),
'query_args' => array(
'post_status' => 'publish',
'posts_per_page' => - 1,
),
//'columns' => 6
),
array(
'name' => esc_html__( 'Category', 'your-prefix' ),
'id' => $prefix . 'category',
'type' => 'taxonomy_advanced',
'taxonomy' => 'product_cat',
'clone' => true,
// How to show taxonomy: 'checkbox_list' (default) or 'checkbox_tree', 'select_tree', select_advanced or 'select'. Optional
'field_type' => 'select_tree',
'query_args' => array(),
),
array(
'name' => esc_html__( 'Attribute', 'your-prefix' ),
'desc' => esc_html__( 'Select the attribute you want to target, and then the attribute value.', 'your-prefix' ),
'id' => $prefix . 'attribute',
'type' => 'select_advanced',
'options' => array(
'todo' => 'TODO',
),
'columns' => 4
),
array(
'name' => esc_html__( 'Condition', 'your-prefix' ),
'desc' => esc_html__( 'Select the attribute you want to target, and then the attribute value.', 'your-prefix' ),
'id' => $prefix . 'attribute',
'type' => 'select_advanced',
'options' => array(
'=' => 'Equal',
'!=' => 'Not Equal',
'>=' => 'Greater Than or Equal',
'>' => 'Greater Than',
'<=' => 'Less Than or Equal',
'<' => 'Less Than',
'%' => 'LIKE',
),
'columns' => 4
),
array(
'name' => esc_html__( 'Attribute Value', 'your-prefix' ),
'desc' => esc_html__( 'Type in the attribute value you want to target', 'your-prefix' ),
'id' => $prefix . 'attribute_value',
'type' => 'text',
'columns' => 4
),
array(
'name' => esc_html__( 'Product Title Phrase', 'your-prefix' ),
'desc' => esc_html__( 'target specific products that have this phrase in the title', 'your-prefix' ),
'id' => $prefix . 'title_phrase',
'type' => 'text',
),
),
);
$meta_boxes[] = array(
'id' => 'restriction_action_messages',
'title' => esc_html__( 'Action Messages', 'your-prefix' ),
'post_types' => array( 'restrictions' ),
// List of meta fields
'fields' => array(
array(
'name' => esc_html__( 'Cart Message', 'your-prefix' ),
'desc' => esc_html__( 'Display a specific message on the cart below the matching product.', 'your-prefix' ),
'id' => $prefix . 'cart_message',
'type' => 'textarea',
'rows' => 4,
),
array(
'name' => esc_html__( 'Checkout Message', 'your-prefix' ),
'desc' => esc_html__( 'Display a specific message on the checkout below the matching product.', 'your-prefix' ),
'id' => $prefix . 'checkout_message',
'type' => 'textarea',
'rows' => 4,
),
),
);
$meta_boxes[] = array(
'id' => 'restriction_actions',
'title' => esc_html__( 'Action', 'your-prefix' ),
'post_types' => array( 'restrictions' ),
// List of meta fields
'fields' => array(
array(
'name' => esc_html__( 'Perform Following Action', 'your-prefix' ),
'desc' => esc_html__( 'Please select the action that will be triggered on the checkout process.', 'your-prefix' ),
'id' => $prefix . 'action',
'type' => 'radio',
'options' => array(
'disallow_purchase' => 'Disallow Purchase',
'foid_card_required' => 'FOID Card Required',
'ffl_dealer_form' => 'FFL Dealer Form',
)
),
),
);
return $meta_boxes;
}
Any updates please?
Hi there,
Sorry for late. I have already checked with your code but it works. And meta box doesn't look like your screenshot. Which version of meta box and extensions are you using?
Meta Box 4.12.3
MB Term Meta 1.2
Meta Box Columns 1.1
Meta Box Updater 1.1.4
Hi,
I checked again and again but can't find the problem. Can you share your credential for us to check it? If yes, please send the credential to [email protected]
Thank you very much.
I received your information. Please wait for me to check it. Thank you.
UPDATE: I fixed the problem. Please get latest version of meta box from github. This is the change: https://github.com/rilwis/meta-box/commit/478fed2fff7ba4396e57f328598e338013fe142f
Thank you very much.