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

Hide specific category tag on single post page

For specifically post categories, you can use get_the_categories filter hook to remove certain found category (term). function filter_get_the_category( $categories, $post_id ) { // loop post categories foreach ($categories as $index => $category) { // check for certain category, you could also check for $term->slug or $term->term_id if ( ‘Featured’ === $category->name ) { // remove … Read more