Custom post types not showing on category archive pages
-
Am having a problem with my custom post types on a website I’m building. I have a custom post type called “article” on the site, and it’s configured to use categories. However, when I go to the categories where these custom posts are assigned, I get a “not found” error.
The site does not use the regular posts. However, when I created one as a test in the course of troubleshooting this problem, the archive page for the category that I placed the regular post into started working. Any categories that don’t contain the test post still don’t work. And the “article” posts don’t show up in the category archive. When the regular post is in the category, it is the only thing that shows up in the category.
However, the custom posts go into the categories just fine on the dashboard, and when I use the “collapsing categories” plugin widget, everything works great. It’s just the category archive page that doesn’t work.
This is how I registered the custom post type:
<?php add_action( 'init', 'create_my_post_types' ); function create_my_post_types() { register_post_type( 'article', array( 'labels' => array( 'name' => __( 'Articles' ), 'singular_name' => __( 'Article' ), 'add_new_item' => __( 'Add New Article' ), 'edit_item' => __( 'Edit Article' ) ), 'show_ui' => true, 'public' => true, 'has_archive' => true, 'supports' => array('title', 'editor', 'author', 'custom-fields', 'thumbnail', 'comments', 'revisions', 'trackbacks'), 'taxonomies' => array('category'), ) ); } ?>
What am I doing wrong?
- The topic ‘Custom post types not showing on category archive pages’ is closed to new replies.