how to show only last child terms of a taxonomy

Đã có trọn bộ đề thi thử THPT Quốc Gia 2022 các môn: vip.dethihsg247.com

I’m trying to show the only the last child terms of a taxonomy in a post.

For example, the post “Johnny Pastafrolla” has the following terms of the taxonomy “camp” selected:

In this case, the displayed terms are gonna be:
Summer Camp 2018, Summer Camp 2019, Space Camp, Winter Camp 2017

I found a code online which is doing this, but for Categories.

I’m trying to “adapt it” for this specific taxonomy, but I’m kind of lost.
Any hint?

Thank you

Dave

Xin chào các bạn và quý Thầy Cô. Hãy nhập từ khóa mình muốn vào ô tìm kiếm trên Website để tìm kiếm mọi thứ hoặc trên google các bạn hãy nhập từ khóa + dethihsg247.com để tìm kiếm các bài viết của chúng tôi nhé.
  • Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
  • Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
  • Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.

Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com