2

If I add a post to a parent and child category, I know that only the parent category will be shown in the permalink. For example, if the parent category was "Clothing" and the child category was "Pants", the permalink would look like "mysite.com/clothing/post" instead of "mysite.com/clothing/pants/post".

I also know that the fix to this would be to ONLY add the post to the child category, "Pants".

My problem is that it's necessary for me to add posts to both their parent and child categories. Is there any way for me to add a post to a parent and child category AND have both the parent and child categories appear in the permalink?

1
  • I could also do with a solution for this. If I find out I will post it below.
    – Sambuxc
    Commented Jan 25, 2021 at 13:30

2 Answers 2

0

Unless I'm misunderstanding, you should be able to do this by adding /%category%/%postname%/ to the custom option in Settings > Permalinks. Remember to save the permalinks change twice to get Wordpress to flush the cache and rewrite your pretty permalink URLs!

0
0

The way I have achieved getting the subcategory or child category in the URL address is...

  1. Create the category and select the parent of it under 'Posts' -> 'Category' tab.

  2. Do not select both the parent AND subcategory. When editing the post, choose only the child category (subcategory) you want it to be listed under.

Alternatively, you can select both the Parent AND Child category but you will need to make the child category marked as primary.

Voila!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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