Hi there -
I have a taxonomy that includes parent/child options.
I need to set up a condition to show a group based on whether the child is selected.
I can get the show/hide functionality to work when there are no child options related, but cannot it doesn't work when there are.
Here's a screen recording: https://www.awesomescreenshot.com/video/18566416?key=4e280436262f2fad7cf8c44c23021413
The start was meant to show the taxonomy IDs but they seemed to get cut off.
Here they are:
Taxonomy: Test options
<ul>
<li>On = 106
</ul>
<li>Options = 108
</li>
<li>On = 109
</li>
<ul>
Here's the PHP Code:
<div><?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
function your_prefix_function_name( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'id' => 259,
'post_types' => ['member-content'],
'fields' => [
[
'name' => __( 'Taxonomy', 'your-text-domain' ),
'id' => $prefix . 'taxonomy_ouqiyz69ayl',
'type' => 'taxonomy_advanced',
'taxonomy' => ['test-option'],
'field_type' => 'select_tree',
],
[
'name' => __( 'Show when taxonomy is On (no child)', 'your-text-domain' ),
'id' => $prefix . 'show_when_parent_taxonomy_is_on',
'type' => 'text',
'visible' => [
'when' => [['taxonomy_ouqiyz69ayl', 'in', 106]],
'relation' => 'and',
],
],
[
'name' => __( 'Show when child taxonomy is On', 'your-text-domain' ),
'id' => $prefix . 'child_taxonomy_on',
'type' => 'text',
'visible' => [
'when' => [['taxonomy_ouqiyz69ayl', 'in', ['109']]],
'relation' => 'and',
],
],
],
];
return $meta_boxes;
}</div>
Any ideas?
Thanks!