I have created a custom post type with two custom taxonomies, which will eventually be used to filter the results in the custom post type. The problem I am having is that I would like the URL to read:
site-url/custom-post-type/custom-taxonomy
I've tried using some of the suggestions for people with similar problems on here, but I cannot get it working in this instance. This is the code I have at the moment, I've stripped it back as the attempts to get this working were in vain:
//Custom Post Types
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'listing',
array(
'labels' => array(
'name' => __( 'Listings' ),
'singular_name' => __( 'Listing' )
),
'public' => true,
'has_archive' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array( 'slug' => 'directory', 'with_front' => false ),
'query_var' => false,
'supports' => array( 'title', 'editor' )
)
);
}
//Region Taxonomies
function region_taxonomy() {
register_taxonomy(
'region',
'listing',
array(
'hierarchical' => true,
'label' => 'Regions',
'query_var' => true,
'rewrite' => array('slug' => 'region', 'with_front' => true )
)
);
}
add_action( 'init', 'region_taxonomy' );
//Qualifications Taxonomies
function qualification_taxonomy() {
register_taxonomy(
'qualification',
'listing',
array(
'hierarchical' => true,
'label' => 'Qualifications',
'query_var' => true,
'rewrite' => array('slug' => 'qualification' )
)
);
}
Currently this produces:
site-url/region/ or /qualification/
Would be great if someone can help me out with this, wasted hours going round in circles!