7

I have created a Custom Post Type with the name Product. I have created a Custom Taxonomy for that post type by the name of products. That taxonomy have a few terms (printer, keyboard, mouse etc) I have created a template with the name taxonomy-products.php

If I visit the url example.com/products/printer/ it loads the taxonomy template and correctly displays the posts that are attached to that term.

My problem: if I visit the url example.com/products/ I get a 404 error.

My question: is there a template file for the taxonomy archive page?

1 Answer 1

6

That is how taxonomies works by default in WordPress. There is not an archive page for "All posts that belongs to any term of a taxonomy". And, conceptually, it is correct.

Imagine you want to list all items of a biological taxonomy system: that is listing all organisms. If you translate to posts, it is what blog and custom post types archives do.

Same applies for core taxonomies, categories and tags, if you go to example.com/category/ or example.com/tag/, you will get a "404 Not found" HTTP code status, which is correct.

If you want to have the URL example.com/products display some content, you can create a page, or a Rewrite Endpoint, and make a custom query for that URL.

3
  • Thanks for your reply. Is there a way that I can control what template will load on /products/? My plan is to have a list of all the terms belonging to that taxonomy, that will link to each term url.
    – Keat
    Commented Aug 9, 2016 at 15:46
  • 1
    Yes, template_include filter is the most common way to include custom templates. There are hundreds of examples in this site for that, try to use the search box. If you choose to use a page, you can use a page template.
    – cybmeta
    Commented Aug 9, 2016 at 15:48
  • 2
    Ok, thank you for clearing that out. I will use a page template then. I just wanted to be sure that I havent missed anything about templates before starting to code that page.
    – Keat
    Commented Aug 9, 2016 at 15:51

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.