I created a custom post with a custom category like so
function fitters() {
$labels = array(
'name' => _x( 'Fitters', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Fitter', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Fitters', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'all_items' => __( 'All Fitters', 'text_domain' ),
'view_item' => __( 'View Fitter', 'text_domain' ),
'add_new_item' => __( 'Add New Fitter', 'text_domain' ),
'add_new' => __( 'Add New', 'text_domain' ),
'edit_item' => __( 'Edit Fitter', 'text_domain' ),
'update_item' => __( 'Update Fitter', 'text_domain' ),
'search_items' => __( 'Search Fitters', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
);
$args = array(
'label' => __( 'fitter', 'text_domain' ),
'description' => __( 'Post Type Description', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', ),
'taxonomies' => array( 'fitter_categories', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'menu_icon' => 'dashicons-businessman',
);
register_post_type( 'fitter', $args );
}
function fitter_taxonomy() {
register_taxonomy(
'fitter_categories', //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
'fitter', //post type name
array(
'hierarchical' => true,
'label' => 'Fitter States', //Display name
'query_var' => true,
'rewrite' => array(
'slug' => 'fitter', // This controls the base slug that will display before each term
'with_front' => false // Don't display the category base before
)
)
);
}
add_action( 'init', 'fitter_taxonomy');
When I try to view the archive for just that category I get a 404 error. Anyone know why?
So when I go to mysite.com/fitter it will list all the posts. If I try to go to mysite.com/fitter/category-name I get a 404 error