Custom Fields
Re-Envisioned
Support Meta Box Conditional Logic Conditional logic does not work based on a taxonomy field Reply To: Conditional logic does not work based on a taxonomy field

#13407

Hansjakob Fehr
Participant

… and here is the code:

function Buch( $meta_boxes ) {
    $meta_boxes[] = array(
        'title' => 'Buch',
        'context' => 'advanced',
        'autosave' => true,
        'visible' => array (
            'when' => array (
            array('slug:tax_input[medium]', '=', 'buch' ),
          ),
        'fields' => array(
            array(
            'id' => 'format',
            'type' => 'text',
            'name' =>  'Format',
            ),
        ),
    );
    return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'Buch' );

function Projekt( $meta_boxes ) {
    $meta_boxes[] = array(
        'title' => 'Projekt',
        'context' => 'advanced',
        'autosave' => false,
        'fields' => array(
            array(
            'name' => 'Datum',
            'id' => 'datumProjekt',
            'type' => 'date',
            'columns' => 3,
            ),
            array(
            'name' => 'Medium',
            'id' => 'medium',
            'type' => 'taxonomy_advanced',
            'taxonomy' => 'medium',
            'field_type' => 'select_advanced',
            'columns' => 3,
            'hidden' => array( 'levelSerie', '=', 'subS' ),
            ),
        ),
    ); 
}
    return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'Projekt' );