How to add the category slug to the post slug (1 post)

  1. Bonesnap
    Posted 3 years ago #


    This seems like quite an easy thing to do, and I thought I had accomplished it in the past but I can't find a past project with it.

    I have a custom post type, lets call it "fish". Rewrite slug has been set to "fish". All these posts will have one of two categories: large or small (lg and sm for their slugs, respectively). I have registered a taxonomy with the custom post called gp_tag. Hierarchical is set to true since I want them to act like a category and not a tag.

    I have modified my permalink structure to /%category%/%postname%/ but it seems to ignore the %category% portion of it.

    If I add a post and assign it to the small category, I would expect a URL to look like website.com/fish/sm/barracuda, but instead I get website.com/fish/barracuda.

    How do I "force" the category slug to be part of the post URL? Remember, all these posts will have one of these categories. The permalink page on the Codex doesn't seem to give any answers.

    Thank you in advance for any insight!

Topic Closed

This topic has been closed to new replies.

About this Topic