admin管理员组

文章数量:1122832

I have a travel blog with multiple categories and subcategories and I'm trying to find/create some code to include on my functions.php file so the permalink only contains the last nested subcategory instead of all the parents. Not looking for a plugin to make this to avoid relying on the developer to keep it updated.

Basically I would like to replace this mysite/europe/italy/rome/

with this mysite/rome/

I found this 13 years old question with a response that contains exactly what I need but I tested it and it's not working on my site. Since the response is pretty old, I'm not sure if that code doesn't work anymore or if it is correct and something else has to be changed on my end.

Thanks in advance for anyone who can help me figure this out.

本文标签: categoriesDisplay last category child in permalink