Support » Themes and Templates » Custom Post Type Archive Page 404's and I don't know why?

  • Resolved datdesignguy



    I’m building an e-commerce store for a client with a “product” custom-post-type. I’ve created the top-level archive page as indicated in the codex for the post-type and it is stored in my theme folder as “archive-product.php”

    When I visit the url for my custom post-types archive page, which I believe should be: http://site/products, I get a 404.

    Here is the code I’m using to create my custom-post-type:

    The archive-product.php page doesn’t seem to be getting called when I visit http://site/products. Can anyone help me figure this out?

    I have also attached a custom taxonomy of “catalog” as shown here:

    register_taxonomy("catalog", "product", array("hierarchical" => true, "label" => "Catalogs", "singular_label" => "Catalog", "query_var" => true, "rewrite" => true));

    Could this be changing the way wordpress handles my “product” post-type?

    Much appreciated!

Viewing 1 replies (of 1 total)
  • Ok, after some more searching here is the simple answer:

    #1 If you want to use a custom archive page for your custom-post-type, add an additional argument to your register_post_type() arguments:
    'has_archive' => true

    (This will tell WP to look for an archive template according to the codex template hierarchy using the current slug setting of your custom post type. If you want a custom slug for your archives, replace TRUE with the slug name for example: 'has_archive' => 'products' might be the slug you want to use with a ‘product’ post_type.)

    #2 Visit the Settings -> Permalinks page to flush your current rewrite rules and rebuild with the new rules for your custom archive.

    #3 Visit the url to your custom post type archive

    I found a great tutorial for implementing this here:

    Good luck!

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Post Type Archive Page 404's and I don't know why?’ is closed to new replies.