Is there any way (plugin or function), to include the sub-category and the category automatically in the permalink structure?

I want an URL structure like this:



set the permalink as


When you set a category parent of child, the permalink will be


I tried and worked fine!


  • 2
    Thanks for sharing this. It's working for me! But for this you need to assign only "sub-category" to the post. Means, I have a post under "parent category > sub-category1", so, I will assign "sub-category1" to the post and not the "parent category" and "sub-category1". – Anuja Patil May 20 '13 at 9:15
  • Just to add clarity; only assign the child-category to include both parent and child in the URL, otherwise, if you pick both then it will assign it to parent only in the URL – WolfieZero Oct 1 '14 at 11:36

protected by Community Jun 27 '14 at 8:12

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.