MB Conditional Logic not working in MB Blocks (Normal Context)
Support › MB Conditional Logic › MB Conditional Logic not working in MB Blocks (Normal Context)
- This topic has 3 replies, 2 voices, and was last updated 3 weeks, 6 days ago by
Peter.
-
AuthorPosts
-
March 25, 2026 at 4:00 PM #49842
[email protected]
ParticipantHi,
I'm experiencing an issue with MB Conditional Logic and MB Blocks following the most recent update.
Conditional logic has stopped working inside the modal window of a block when the context is set to normal.
When opening the modal to edit the fields, the conditional logic is ignored—fields that should be hidden are either permanently hidden or the logic simply doesn't trigger when values change.
The fields inside the modal should respect the conditional logic rules, hiding or showing based on the defined dependencies, as they did in previous versions.
Is this a known bug in the latest release? Any temporary workaround or fix would be greatly appreciated.
Best regards,
March 25, 2026 at 8:14 PM #49843Peter
ModeratorHello,
Thanks for reaching out.
How do you create the modal with custom fields when editing the post? Can you please share a screen record of the issue and share the JSON field group after exporting?
Following the documentation https://docs.metabox.io/extensions/meta-box-builder/#export--importMarch 26, 2026 at 5:15 PM #49850[email protected]
ParticipantHi,
I’m providing the block details for reference. As you can see, there are fields conditioned to the 'Formulario' checkbox. When checked, these fields should be visible, but they remain hidden.
Interestingly, if I change the attribute to 'context' => 'aside', the conditional logic works perfectly. The issue only occurs when using 'context' => 'normal'.
Best regards.
add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) { $meta_boxes[] = [ 'title' => __('Hero Landing', THEME_DOMAIN), 'id' => 'hero-landing', 'description' => __('Hero Landing', THEME_DOMAIN), 'type' => 'block', 'icon' => 'awards', 'category' => 'blocks', 'enqueue_assets' => function () { wp_enqueue_style('theme-header', get_template_directory_uri() . '/assets/css/main.css'); wp_enqueue_style('theme-icons-header', get_template_directory_uri() . '/assets/css/icons.css'); }, 'render_template' => THEME_DIR_PATH . '/gutenberg-blocks/hero-landing/template.php', 'preview' => [ 'esPreview' => '1', 'capture' => get_template_directory_uri() . '/assets/img/hero-landing.png', ], 'supports' => [ 'customClassName' => true ], 'context' => 'normal', 'fields' => [ [ 'type' => 'text', 'id' => 'id', 'name' => __('Identificador', THEME_DOMAIN), ], [ 'type' => 'text', 'id' => 'class_style', 'name' => __('Clase CSS', THEME_DOMAIN), ], [ 'type' => 'single_image', 'id' => 'image', 'name' => __('Imagen Fondo', THEME_DOMAIN), ], [ 'name' => __('Color Fondo Tarjeta', THEME_DOMAIN), 'id' => 'background_card', 'type' => 'color', 'alpha_channel' => true, 'js_options' => [ 'palettes' => [ '#4066ff', '#1c46eb', '#0027c2', '#0021a6', '#001a80', '#f2faff', '#e0f2ff', '#bde0f8', '#8fbcdb', '#6b9dbf', ], ], ], [ 'type' => 'wysiwyg', 'id' => 'text', 'name' => __('Contenido Tarjeta', THEME_DOMAIN), 'raw' => true, 'options' => [ 'textarea_rows' => 4, 'teeny' => true, ] ], [ 'name' => __('¿Formulario?', THEME_DOMAIN), 'id' => 'is_form', 'type' => 'checkbox', 'std' => 0 ], [ 'name' => __('Color Fondo Tarjeta', THEME_DOMAIN), 'id' => 'background_form', 'type' => 'color', 'alpha_channel' => true, 'js_options' => [ 'palettes' => [ '#4066ff', '#1c46eb', '#0027c2', '#0021a6', '#001a80', '#f2faff', '#e0f2ff', '#bde0f8', '#8fbcdb', '#6b9dbf', ], ], 'hidden' => ['is_form', '!=', 1] ], [ 'name' => __('Titulo Formulario', THEME_DOMAIN), 'id' => 'form_title', 'type' => 'wysiwyg', 'raw' => true, 'options' => [ 'textarea_rows' => 4, 'teeny' => true, ], 'hidden' => ['is_form', '!=', 1] ], [ 'type' => 'text', 'id' => 'short_code', 'name' => __('Codigo Formulário', THEME_DOMAIN), 'hidden' => ['is_form', '!=', 1] ], ] ]; return $meta_boxes; });March 26, 2026 at 10:18 PM #49853Peter
ModeratorHello
I can reproduce the issue on my demo site and I've escalated the issue to the development team to fix it as soon as possible.
In the meantime, you can use the contextsideto make the conditional logic works properly.Thank you.
-
AuthorPosts
- You must be logged in to reply to this topic.