0
votes

i have a custom taxonomy named sm-category

Area
- area 1
- area 2

Shop
- shop 1
- shop 2

In single custom post page i want to display just the current area of the post, lets say 'area 1'.

The get_term_children($term_id, 'sm-category') will retrieve a list with all children but i want only the current child of the post.

Any solution there?

Thanks in advance

1

1 Answers

0
votes

Than get the first child,..

 $subcategorys = get_term_children($term_id, 'sm-category');
 print_r($subcategorys[0]); // The first entry