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

If I understoon you correctly, you want to have two selects, one for parent terms and the other for child terms, which will be dynamically populated based on the parent selection. Right? First you need the html markup for the select elements. <select name=”parent_term”> <option value=””><?php esc_html_e(‘Selecciona País’, ‘eltd-tours’); ?></option> <?php echo implode( ”, my_select_options( … Read more

Get and display category name by category description

I’m not aware of a built-in function like “get_cat_name_by_desc()”, but you can use the description__like parameter along with get_categories() or get_terms(): $cats = get_categories( [ ‘description__like’ => ‘foo desc’, ‘hide_empty’ => false, // disabled for testing purposes ] ); echo isset( $cats[0] ) ? $cats[0]->name : ‘No categories found.’;

echo $category[0]-> cat_name; shows only one category name

In your code: $category = get_the_category(); echo $category[0]-> cat_name; get_the_category() returns and array of WP_Term objects. You are getting the first one from the array, and echoing only that one category name. I’d recommend using get_the_category_list() instead. $categories_list = get_the_category_list( esc_html__( ‘, ‘, ‘html5blank’ ) ); if ( $categories_list ) { echo ‘<li><p class=”meta-txt”>’, esc_html__( … Read more