Bug: Conditional Logic Set On Value Of Taxonomy Custom Field Prevents Post Save
Support › MB Conditional Logic › Bug: Conditional Logic Set On Value Of Taxonomy Custom Field Prevents Post Save
- This topic has 7 replies, 2 voices, and was last updated 2 years, 1 month ago by
Peter.
-
AuthorPosts
-
February 14, 2023 at 11:59 PM #40523
James Cooper
ParticipantI added a custom taxonomy field and a custom group field. I set conditional logic on the group field to display when the selected taxonomy contained a certain keyword. When this is active, if I go to the post where the custom fields are inserted and select the taxonomy term via the custom taxonomy field, and then try to save the post, the save does not work.
February 15, 2023 at 12:04 AM #40524James Cooper
ParticipantI'll also mention that although I have only added one taxonomy field named product_merchant, two options for the field appear in the conditional logic selection. This also seems to be a bug.
February 15, 2023 at 10:08 PM #40535Peter
ModeratorHello James,
Can you please share the code that you use to create the conditional logic and custom fields on your site? And please share some screenshots or a screen record of the issue. I will try to reproduce it on my local site to see if it is a bug.
February 21, 2023 at 12:07 AM #40627James Cooper
ParticipantI can't seem to reproduce the 'Post Save' issue currently. So, maybe it has resolved itself somehow.
However, I have recorded a video of the second issue I mentioned (duplicate values in the conditional logic select box).
Duplicate Values In Conditional Logic Select Box
Here is the generated PHP code as well:
<?php add_filter( 'rwmb_meta_boxes', 'product_custom_fields' ); function product_custom_fields( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'Product', 'product' ), 'id' => 'product', 'post_types' => ['product'], 'fields' => [ [ 'type' => 'heading', 'name' => __( 'Product Details', 'product' ), ], [ 'name' => __( 'Product Description', 'product' ), 'id' => $prefix . 'product_description', 'type' => 'wysiwyg', ], [ 'name' => __( 'Product Categories', 'product' ), 'id' => $prefix . 'product_categories', 'type' => 'taxonomy', 'taxonomy' => ['product-category'], 'field_type' => 'select_advanced', 'placeholder' => __( 'Select categories', 'product' ), 'add_new' => true, 'remove_default' => true, 'multiple' => true, ], [ 'name' => __( 'Product Type', 'product' ), 'id' => $prefix . 'product_type', 'type' => 'taxonomy', 'taxonomy' => ['product-type'], 'field_type' => 'select_advanced', 'placeholder' => __( 'Select a product type', 'product' ), 'add_new' => true, 'remove_default' => true, ], [ 'name' => __( 'Merchant', 'product' ), 'id' => $prefix . 'product_merchant', 'type' => 'taxonomy', 'taxonomy' => ['merchant'], 'field_type' => 'select_advanced', 'placeholder' => __( 'Select a merchant', 'product' ), 'add_new' => true, 'remove_default' => true, ], [ 'name' => __( 'Brand', 'product' ), 'id' => $prefix . 'product_brand', 'type' => 'taxonomy', 'taxonomy' => ['brand'], 'field_type' => 'select_advanced', 'placeholder' => __( 'Select a brand', 'product' ), 'add_new' => true, 'remove_default' => true, ], [ 'name' => __( 'Intended Use', 'product' ), 'id' => $prefix . 'product_intended_use', 'type' => 'text', ], [ 'name' => __( 'Schema Categorization', 'product' ), 'id' => $prefix . 'product_schema_categorization', 'type' => 'button_group', 'options' => [ 'uncategorized' => __( 'Uncategorized', 'product' ), 'tool' => __( 'Tool', 'product' ), 'supply' => __( 'Supply', 'product' ), ], 'std' => 'uncategorized', 'tooltip' => [ 'icon' => '', 'position' => 'top', 'content' => 'Supplies and tools are used to complete the how-to instructions.', ], ], [ 'name' => __( ' ', 'product' ), 'id' => $prefix . 'product_schema_categorization_tool_message', 'type' => 'custom_html', 'std' => '<span>A tool is used (but not consumed) when performing instructions for how to achieve a result.</span>', 'visible' => [ 'when' => [['product_schema_categorization', '=', 'tool']], 'relation' => 'or', ], ], [ 'name' => __( ' ', 'product' ), 'id' => $prefix . 'product_schema_categorization_supply_message', 'type' => 'custom_html', 'std' => '<span>A supply is consumed when performing the instructions for how to achieve a result.</span>', 'visible' => [ 'when' => [['product_schema_categorization', '=', 'supply']], 'relation' => 'or', ], ], [ 'type' => 'heading', 'name' => __( 'Pricing', 'product' ), ], [ 'name' => __( ' ', 'product' ), 'id' => $prefix . 'product_pricing_group', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'fields' => [ [ 'name' => __( 'Pricing Label', 'product' ), 'id' => $prefix . 'product_pricing_label', 'type' => 'text', 'columns' => 6, ], [ 'name' => __( 'Price', 'product' ), 'id' => $prefix . 'product_price', 'type' => 'number', 'columns' => 6, ], ], ], [ 'type' => 'heading', 'name' => __( 'Core Features & Benefits', 'product' ), ], [ 'name' => __( ' ', 'product' ), 'id' => $prefix . 'product_core_features', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'tooltip' => [ 'icon' => '', 'position' => 'top', 'content' => 'These are the features that readers care about most.', ], 'fields' => [ [ 'name' => __( 'Feature', 'product' ), 'id' => $prefix . 'product_feature', 'type' => 'text', ], [ 'name' => __( 'Feature Icon', 'product' ), 'id' => $prefix . 'product_feature_icon', 'type' => 'single_image', ], [ 'name' => __( 'Feature Rating', 'product' ), 'id' => $prefix . 'product_feature_rating', 'type' => 'star_rating', ], [ 'name' => __( 'Feature Details', 'product' ), 'id' => $prefix . 'product_feature_details', 'type' => 'wysiwyg', ], [ 'name' => __( 'Feature Benefit', 'product' ), 'id' => $prefix . 'product_feature_benefit', 'type' => 'text', 'tooltip' => [ 'icon' => '', 'position' => 'top', 'content' => 'How does this feature benefit the reader?', ], ], ], ], [ 'type' => 'heading', 'name' => __( 'Recommended For', 'product' ), ], [ 'name' => __( 'Recommended For', 'product' ), 'id' => $prefix . 'product_recommended_for', 'type' => 'text', 'clone' => true, 'sort_clone' => true, 'tooltip' => [ 'icon' => '', 'position' => 'top', 'content' => 'Who is this product recommended for?', ], ], [ 'type' => 'heading', 'name' => __( 'Pros & Cons', 'product' ), ], [ 'name' => __( 'Pros', 'product' ), 'id' => $prefix . 'product_pros', 'type' => 'text', 'clone' => true, 'sort_clone' => true, ], [ 'name' => __( 'Cons', 'product' ), 'id' => $prefix . 'product_cons', 'type' => 'text', 'clone' => true, 'sort_clone' => true, ], [ 'type' => 'heading', 'name' => __( 'Alternatives', 'product' ), ], [ 'name' => __( 'Alternatives Label', 'product' ), 'id' => $prefix . 'product_alternatives_label', 'type' => 'text', 'std' => 'Alternatives', 'columns' => 6, 'datalist' => [ 'id' => '63f3a88019885', 'options' => [ 'Alternatives ', 'Competitors ', 'Replacements', ], ], ], [ 'name' => __( 'Alternative (#)', 'product' ), 'id' => $prefix . 'product_alternative', 'type' => 'post', 'post_type' => ['product'], 'field_type' => 'select_advanced', 'clone' => true, 'sort_clone' => true, ], [ 'name' => __( 'Product Alternatives', 'product' ), 'id' => $prefix . 'product_alternatives_group', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'fields' => [ [ 'name' => __( 'Alternative Name', 'product' ), 'id' => $prefix . 'product_alternative_name', 'type' => 'text', 'columns' => 6, ], [ 'name' => __( 'Alternative URL', 'product' ), 'id' => $prefix . 'product_alternative_url', 'type' => 'url', 'placeholder' => __( 'http://www.alternative-url.com', 'product' ), 'columns' => 6, ], [ 'name' => __( 'Best For', 'product' ), 'id' => $prefix . 'product_alternative_best_for', 'type' => 'text', ], [ 'name' => __( 'Price', 'product' ), 'id' => $prefix . 'product_alternative_price', 'type' => 'text', ], ], ], [ 'type' => 'heading', 'name' => __( 'Media', 'product' ), ], [ 'name' => __( 'Product Image', 'product' ), 'id' => $prefix . 'product_image', 'type' => 'single_image', 'image_size' => 'image-1000', ], [ 'name' => __( 'Product Gallery', 'product' ), 'id' => $prefix . 'product_image_gallery', 'type' => 'image_advanced', 'image_size' => 'image-1000', ], [ 'type' => 'heading', 'name' => __( 'Link Details', 'product' ), ], [ 'name' => __( 'Product Link', 'product' ), 'id' => $prefix . 'product_link', 'type' => 'url', 'placeholder' => __( 'http://www.link-to-product.com', 'product' ), ], [ 'name' => __( 'Product link is an affiliate link?', 'product' ), 'id' => $prefix . 'product_link_is_affiliate_link', 'type' => 'checkbox', ], [ 'name' => __( 'Link Text', 'product' ), 'id' => $prefix . 'product_link_text', 'type' => 'text', 'tooltip' => [ 'icon' => '', 'position' => 'top', 'content' => 'If the product link is added to content as text, this is the text that is used for the link.', ], ], [ 'type' => 'heading', 'name' => __( 'Card Details', 'product' ), 'desc' => __( 'Add information for elements the are displayed on product cards.', 'product' ), ], [ 'name' => __( 'Card Heading', 'product' ), 'id' => $prefix . 'product_card_heading_choice', 'type' => 'button_group', 'options' => [ 'linktext' => __( 'Use Link Text For Card Heading', 'product' ), 'custom' => __( 'Add Custom Card Heading', 'product' ), ], 'std' => 'linktext', ], [ 'name' => __( 'Custom Heading', 'product' ), 'id' => $prefix . 'product_card_heading', 'type' => 'text', 'visible' => [ 'when' => [['product_card_heading_choice', '=', 'custom']], 'relation' => 'or', ], ], [ 'name' => __( 'Sub Heading', 'product' ), 'id' => $prefix . 'product_card_sub_heading', 'type' => 'text', ], [ 'name' => __( 'CTA Text', 'product' ), 'id' => $prefix . 'product_CTA_text', 'type' => 'text', 'tooltip' => [ 'icon' => '', 'position' => 'top', 'content' => 'Use actionable text to be displayed on buttons.', ], ], [ 'name' => __( 'Do you own this product?', 'product' ), 'id' => $prefix . 'product_own_it', 'type' => 'checkbox', 'tooltip' => [ 'icon' => '', 'position' => 'top', 'content' => 'When selected, an "Own It" ribbon is displayed on the product card.', ], ], [ 'type' => 'heading', 'name' => __( 'Product Amazon Codes', 'product' ), ], [ 'id' => $prefix . 'product_amazon_codes', 'type' => 'group', 'fields' => [ [ 'name' => __( 'Amazon Image Code', 'product' ), 'id' => $prefix . 'product_amazon_image_code', 'type' => 'textarea', 'rows' => 10, ], [ 'name' => __( 'Amazon Native Ads Code', 'product' ), 'id' => $prefix . 'product_amazon_native_ads_code', 'type' => 'textarea', 'rows' => 11, ], ], 'visible' => [ 'when' => [['product_mercant', '=', 'amazon']], 'relation' => 'or', ], ], [ 'name' => __( ' ', 'product' ), 'id' => $prefix . 'product_add_brand_link', 'type' => 'custom_html', 'std' => '<a href="/wp-admin/post-new.php?post_type=review" target="_blank" class="button">+ Add Review</a>', ], ], ]; return $meta_boxes; }
February 21, 2023 at 6:30 PM #40640Peter
ModeratorHello,
Thanks for your details. I see that issue on my demo site and I've escalated this issue to the development team to fix it in the next update.
February 21, 2023 at 11:02 PM #40653James Cooper
ParticipantGreat! Thank you Peter!
February 28, 2023 at 7:05 AM #40752James Cooper
ParticipantHi Peter,
I see that there was an update to Meta Box released today. However, the fix for this issue did not make it into this release. The issue is still present. Any news on when it will be fixed?
Thanks!
February 28, 2023 at 5:59 PM #40755Peter
ModeratorHello,
Thanks for following up. This issue relates to the extension MB Builder, not Meta Box itself. This issue is in our development queue so please wait for the next updates of our plugins.
-
AuthorPosts
- You must be logged in to reply to this topic.