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

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!

Read more here:: How to select a parent category and show the children to choose in another select?

Leave a Reply

Your email address will not be published. Required fields are marked *