0
<?php
/** The taxonomy we want to parse */
$taxonomy = "nearby_amenity_taxonomy";
/** Get all taxonomy terms */
$terms = get_terms($taxonomy, array(
        "orderby"    => "count",
        "hide_empty" => false
    )
);
/** Get terms that have children */
$hierarchy = _get_term_hierarchy($taxonomy);
?>
<select name="terms" id="terms">
    <?php
        /** Loop through every term */
        foreach($terms as $term) {
            /** Skip term if it has children */
            if($term->parent) {
                continue;
            }
           echo '<option class="' . $term->name  . '" value="' . $term->name  . '">' . $term->name . '</option>';
            
        }
    ?>
</select>
  1. How to show the taxonomy term in multiselect checkbox? here is my code
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.