I am trying to create a specific url structure for my custom post type called “products”:

root/products/category-name/product-name/

where:

  1. the leading “products” is just an added string
  2. category-name is the category of a product post
  3. product-name is the title of the product post

So: for a product “Nuts & Coffee” with a category of smoothie – the url would be root/smoothie/nuts-and-coffee.

I thought that it would be as simple as adding this code in the products custom post type:

slug => "products/%category%/"

but when I do that, the category doesn’t show up. Am I implementing the slug wrong or am I going about this wrong?

Any help appreciated!

Read more here: Creating a url structure with category and custom post type, in wordpress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: