Hello: I created a custom post type, anemia, and I realized that all categories I assigned are not being recognized if I go directly to the category link (for example /category/anemia-lifestyle. I get the message: Nothing to Show Right Now
It appears whatever you were looking for is no longer here or perhaps wasn’t here to begin with. You might want to try starting over from the homepage to see if you can find what you’re after from there. Here’s the code for my custom post type. Any thoughts on what causes the categories to not work?
function custom_posttype() {
register_post_type( 'anemia',
// Custom Post Type Options
array(
'labels' => array(
'name' => __( 'Anemia Posts' ),
'singular_name' => __( 'Anemia Post' )
),
'public' => true,
'menu_icon' => 'dashicons-id-alt',
'has_archive' => false,
'hierarchical' => true,
'rewrite' => array('slug' => 'anemia/articles' ),
'supports' => array( 'title', 'editor' , 'post-formats' , 'thumbnail' ),
'taxonomies' => array( 'category' , 'post_tag' ),
)
);
add_action( ‘init’, ‘custom_posttype’ );