Support Forum
Support › Meta Box Conditional Logic › Conditional Logic seems broken since updateResolved
I'm trying to display meta boxes specific to the category that a post belongs to. This was working before the update, but now it's not. It looks like all conditional logic is broken, because I can see the condition to "Test = Not Test" and it will still show the meta box (even though "Test" is definitely not equal to "Not Test". Any idea what might be causing this?
Hi,
Do you mean after updating Meta Box AIO v1.13.0 then the conditional logic is broken? Can you please follow the step Debugging Information and let me know what's going on?
https://support.metabox.io/topic/how-to-create-a-new-topic/
You can also share the code to create the conditional logic, I will test it on my demo site.
Yes, I believe the update to AIO v1.13.0 is when the issue began. I do have automatic updates enabled though, so I'm not 100% sure that's when it happened. I'm using the Builder extension, but here's the code it generated:
<?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
function your_prefix_function_name( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'title' => __( 'Search Engine Optimization Details', 'your-text-domain' ),
'id' => 'search-engine-optimization-details',
'post_types' => ['plugin'],
'autosave' => true,
'visible' => [
'when' => [['_wpo_plugin_category', 'in', 6]],
'relation' => 'and',
],
'fields' => [
[
'name' => __( 'Editing', 'your-text-domain' ),
'id' => $prefix . '_wpo_seo_editing',
'type' => 'checkbox_list',
'desc' => __( 'Which settings can be edited through the SEO plugin\'s interface?', 'your-text-domain' ),
'options' => [
'Bulk editing' => __( 'Bulk editing', 'your-text-domain' ),
'Canonical URLs' => __( 'Canonical URLs', 'your-text-domain' ),
'Meta information' => __( 'Meta information', 'your-text-domain' ),
'robots.txt' => __( 'robots.txt', 'your-text-domain' ),
'.htaccess' => __( '.htaccess', 'your-text-domain' ),
],
],
[
'name' => __( 'Social', 'your-text-domain' ),
'id' => $prefix . '_wpo_seo_social',
'type' => 'checkbox_list',
'desc' => __( 'Which social media structured data is supported?', 'your-text-domain' ),
'options' => [
'Facebook Open Graph' => __( 'Facebook Open Graph', 'your-text-domain' ),
'Twitter Card' => __( 'Twitter Card', 'your-text-domain' ),
'Instagram' => __( 'Instagram', 'your-text-domain' ),
'Pinterest' => __( 'Pinterest', 'your-text-domain' ),
'YouTube' => __( 'YouTube', 'your-text-domain' ),
'LinkedIn' => __( 'LinkedIn', 'your-text-domain' ),
'oEmbed' => __( 'oEmbed', 'your-text-domain' ),
'Discord' => __( 'Discord', 'your-text-domain' ),
],
],
[
'name' => __( 'Structured Data', 'your-text-domain' ),
'id' => $prefix . '_wpo_seo_structured_data',
'type' => 'checkbox_list',
'desc' => __( 'Which structured data types are supported?', 'your-text-domain' ),
'options' => [
'Dublin Core' => __( 'Dublin Core', 'your-text-domain' ),
'Google Knowledge Graph' => __( 'Google Knowledge Graph', 'your-text-domain' ),
'Article' => __( 'Article', 'your-text-domain' ),
'BlogPosting' => __( 'BlogPosting', 'your-text-domain' ),
'Breadcrumbs' => __( 'Breadcrumbs', 'your-text-domain' ),
'Course' => __( 'Course', 'your-text-domain' ),
'Custom schemas' => __( 'Custom schemas', 'your-text-domain' ),
'Event' => __( 'Event', 'your-text-domain' ),
'FAQ' => __( 'FAQ', 'your-text-domain' ),
'HowTo' => __( 'HowTo', 'your-text-domain' ),
'Job' => __( 'Job', 'your-text-domain' ),
'Local business' => __( 'Local business', 'your-text-domain' ),
'Logo' => __( 'Logo', 'your-text-domain' ),
'NewsArticle' => __( 'NewsArticle', 'your-text-domain' ),
'Organization' => __( 'Organization', 'your-text-domain' ),
'Person' => __( 'Person', 'your-text-domain' ),
'Product' => __( 'Product', 'your-text-domain' ),
'Recipe' => __( 'Recipe', 'your-text-domain' ),
'Review' => __( 'Review', 'your-text-domain' ),
'Service' => __( 'Service', 'your-text-domain' ),
'Sitelinks searchbox' => __( 'Sitelinks searchbox', 'your-text-domain' ),
'Software application' => __( 'Software application', 'your-text-domain' ),
'Video' => __( 'Video', 'your-text-domain' ),
],
],
[
'name' => __( 'Automation', 'your-text-domain' ),
'id' => $prefix . '_wpo_seo_automation',
'type' => 'checkbox_list',
'desc' => __( 'Which settings can be automatically generated by the plugin?', 'your-text-domain' ),
'options' => [
'Title' => __( 'Title', 'your-text-domain' ),
'Description' => __( 'Description', 'your-text-domain' ),
'Structured data' => __( 'Structured data', 'your-text-domain' ),
'Image alt' => __( 'Image alt', 'your-text-domain' ),
'robots.txt' => __( 'robots.txt', 'your-text-domain' ),
'Open Graph' => __( 'Open Graph', 'your-text-domain' ),
'Twitter Card' => __( 'Twitter Card', 'your-text-domain' ),
],
],
[
'name' => __( 'Sitemap Support', 'your-text-domain' ),
'id' => $prefix . '_wpo_seo_sitemap_support',
'type' => 'checkbox_list',
'desc' => __( 'Which types of sitemaps are supported?', 'your-text-domain' ),
'options' => [
'XML' => __( 'XML', 'your-text-domain' ),
'HTML' => __( 'HTML', 'your-text-domain' ),
'Author' => __( 'Author', 'your-text-domain' ),
'Image' => __( 'Image', 'your-text-domain' ),
'News' => __( 'News', 'your-text-domain' ),
'Video' => __( 'Video', 'your-text-domain' ),
],
],
[
'name' => __( 'Additional Features', 'your-text-domain' ),
'id' => $prefix . '_wpo_seo_additional_features',
'type' => 'checkbox_list',
'desc' => __( 'What other features does this plugin support?', 'your-text-domain' ),
'options' => [
'Content analysis' => __( 'Content analysis', 'your-text-domain' ),
'Data migration' => __( 'Data migration', 'your-text-domain' ),
'Import/export' => __( 'Import/export', 'your-text-domain' ),
'CSV meta import' => __( 'CSV meta import', 'your-text-domain' ),
'Redirect attachment pages' => __( 'Redirect attachment pages', 'your-text-domain' ),
'RSS optimization' => __( 'RSS optimization', 'your-text-domain' ),
'Google preview' => __( 'Google preview', 'your-text-domain' ),
'Social previews' => __( 'Social previews', 'your-text-domain' ),
],
],
],
];
return $meta_boxes;
}
Hi,
Follow your code I understand that the meta box search-engine-optimization-details
is shown up when the field (outside of this meta box) _wpo_plugin_category
has a value of 6. Just check on my local site with Meta Box AIO 1.13.0 and do not see any error.
Can you please deactivate all plugins except Meta Box, Meta Box AIO, and switch to the default theme of WordPress (Twenty TwentyOne) to check this issue again?
I disabled the rest of the plugins and activated the Twenty Twenty One theme, but I still had the same issue. I even took the relevant code generated by the Meta Box Builder extension, added the code to the functions.php file, and deactivated the AIO plugin, but that didn't help either. Is there a way for me to let you log in and take a look?
Conditional Logic seems to be the problem. I can't get any conditions to have an effect on the visibility of a custom meta box.
Hi,
Conditional logic only works when the plugin Meta Box Conditional Logic or Meta Box AIO (go to Meta Box > Extensions and make sure that extension Meta Box Conditional Logic enable.) activated. Can you please leave Meta Box and Meta Box AIO activated then check this issue?
Yes, I understand that. I have Meta Box AIO installed, and the Conditional Logic extension is enabled. I even re-installed AIO from scratch just to make sure that wasn't the issue. Updating to 1.13.0 is the problem. If I delete 1.13.0 and install 1.12.0 instead, then conditional logic works again.
Hi,
Please share your site credentials via this contact form https://metabox.io/contact/, I will take a closer look.
Thanks Long. I just sent my login details through the form you mentioned.
Hi,
Maybe the CPT slug plugin
caused the issue. I've tested to assign two field groups to post
and do not see any issue so back to the CPT, I changed it to plugin1
slug and conditional logic works as well. Screen record https://share.getcloudapp.com/o0uEx2o1.
It might relate to the Reserved Terms in the new version of WordPress.
https://docs.metabox.io/extensions/mb-custom-post-type/#reserved-terms
Jumping in here, I too have noticed our conditional logic is acting up, but causing "required" hidden fields to block post updates/publishes.
We jumped from: (Meta Box AIO) 1.11.19 -> 1.13.3.
Hi Austin,
Can you please clarify your case? Or share the code that creates the custom fields, I will check it on my end.
Here it is as best I could encode the complete array: https://gist.github.com/thefrosty/15a86daf1bfcffc7d319fcde10ab5581
I've also have a video showing the complex fields and how it is working: (expires in 7 days) https://webmshare.com/play/AWPGQ
I have confirmed the following:
Broken on WordPress 5.6.2 with MB: 5.3.8 & AIO: 1.13.3
Working on WordPress 5.5.x with MB: 5.3.8 & AIO: 1.11.19
Need to figure out if a WordPress 5.6.x or AIO > 1.11.19 issue.