How to select a parent category and show the children to choose in another select?

Question

How to select a parent category and show the children to choose in another select?

this is the code (parent taxonomy)

<select>
<option value=""><?php esc_html_e('Selecciona País', 'eltd-tours'); ?></option>
        <?php 
            //Listado de taxonomias por país
            $tax_terms = get_terms(array(
            'taxonomy' => 'tipo_pais',
            'hide_empty' => false,
            'hierarchical' => true,
            'orderby'    => 'parent',
            'fields' => 'all',
            'parent' => '0',                    ) );
            foreach ($tax_terms as $tax_term) {?>
            <option value=""><?php echo $tax_term->name;?></option>
        <?php }?>

</select>

i need taxonomy child code, help please!

0
Seba Lagos 4 months 2021-01-01T08:10:20-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse