## php – How to get the last category name of a child category?

Question

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.

in progress 0
1 year 2021-11-05T23:33:48-05:00 0 Answer 0 views 0

get_categories( array(