Support » Themes and Templates » "Category" based permalinks for custom "Products" post type

  • Julian Guy



    I’ve created a custom post type using register_post_type called “products” which will be used for holding about 1000 different products. The products are assigned to categories such as “Bathroom furniture > storage” or “Taps”. I’ve got everything working nicely in the admin area but now i’m writing the templates i’m a bit stuck on how to achieve the permalink structure. Here’s what i’d like:

    1. /products – display an archive page of the complete product range (paginated)
    2. /products/CATEGORY – this would list all products in that category as well as any child sub-categories
    3. /products/CATEGORY/SUBCATEGORY – this would list all products in that sub-category
    4. /products/CATEGORY/SUBCATEGORY/PRODUCTSTUB – the actual product

    I started off creating a template called archive-products.php to show the first view and that works fine.

    Next I made single-products.php and that works fine for the 4th view.

    The next thing I tried was changing the category base in the setting > permalinks section of the wp-admin area to “products”. This get’s me really close with views 1-3 all working perfectly but that breaks the 4th view.

    Can anyone help me get the 4th view working?

    Any help much appreciated!


Viewing 5 replies - 1 through 5 (of 5 total)
  • nsathees


    check the permalink under settings in admin page. make sure the wordpress can write to your wp root folder as it will create the .htaccess file.

    once done secure the .htaccess file.

    One more question? how did you import all that content? did you use xl2wp plugin?

    Julian Guy


    Thanks for reply. The .htaccess file is definitely working. I need help achieving the above structures for permalinks, specifically view 4.


    Julian Guy


    Has anybody got any ideas how to achieve this?

    Were you ever able to figure this out? I want to achieve the exact same thing…

    I have a registered post_type project.
    And a taxonomy project_category

    Now I like my permalinks to turn out as

    1. /project – Overview of projects in all categories.
    2. /project/CATEGORY – Overview of projects within that category.
    3. /project/CATEGORY/SUBCATEGORY – Overview of projects within that subcategory.
    4. /project/CATEGORY/SUBCATEGORY/postname – The actual post.

    I’m afraid not. I had to settle on individual products having a
    /product/PRODUCTSTUB URL.

    I managed a kind of version of it by creating a page for each category and then creating a subquery in page.php to bring back posts based on the category. Obviously doesn’t work well if you need to create new categories frequently.

    Let me kn ow if you solve it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘"Category" based permalinks for custom "Products" post type’ is closed to new replies.