I have the following code to register a custom post type and taxonomy for it:
register_post_type( 'gs_business_listings',
array(
'labels' => array(
'name' => __( 'Local Businesses' ),
'singular_name' => __( 'Local Businesses' )
),
'public' => true,
'supports' => array('title', 'editor', 'thumbnail', 'revisions'),
'register_meta_box_cb' => array($this,'add_meta_boxes'),
'rewrite' => array('slug'=> '%larger-region%/%regions%')
)
);
register_taxonomy(
'gs_business_region_harvey',
'gs_business_listings',
array(
'labels' => array(
'name' => 'Harvey County',
'singular_name' => 'Region',
),
'rewrite' => array( 'slug' => 'harvey-county', 'hierarchical' => true ),
'hierarchical' => true,
'has_archive' => true,
)
);
I would expect that accessing www.example.com/harvey-county
would show an archive of all posts that use the custom taxonomy. But I get a 404 not found. What do I have wrong? Thanks.
Note:currently if I access www.example.com/harvey-county/newton
it shows the archive page for the newton
term correctly.
page-harvey-county.php
in the theme with a loop to display all posts that include any terms under that taxonomy work?