Site icon Hip-Hop Website Design and Development

How to get the last category name of a child category?

there. I’ve tried tons of solutions I’ve found in this forum before asking this. It’s kind of hard for me to understand the php sintaxe. I have no idea how to do this and i’ve been stuck for days trying hundreds of codes. Can someone help me?

I have the following categories:

- Animal
-- Dog
--- frenchie-1
--- frenchie-2
--- frenchie-3

Animal > Dog > frenchie-3

I need to get the slug from "frenchie-3", that is the last one in this situation. Maybe in the future will be a frenchie-4 and I would need to retrieve this "new last" category of that child category. I will always need the last one.

Thanks a lot for your attention.