I have custom post type for "rooms" registered, along with a custom taxonomy. Here is the code:
<?php
/*******************************************/
/* Rooms CPT
/*******************************************/
add_action('init', 'room_register');
function room_register() {
$labels = array(
'name' => _x('Rooms', 'post type general name'),
'singular_name' => _x('Room', 'post type singular name'),
'add_new' => _x('Add Room', 'add button'),
'add_new_item' => __('Add New Room'),
'edit_item' => __('Edit Room'),
'new_item' => __('New Room'),
'view_item' => __('View Room'),
'search_items' => __('Search Rooms'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'has_archive' => true,
'capability_type' => 'post',
'hierarchical' => true,
'menu_icon' => 'dashicons-screenoptions',
'supports' => array('title','editor'),
'rewrite' => array( 'slug' => 'rooms/%room_category%', 'with_front' => false )
//'rewrite' => array('slug' => 'products')
);
register_post_type( 'rooms' , $args );
}
/*******************************************/
/* Rooms Taxonomy
/*******************************************/
add_action( 'init', 'rooms_taxonomy', 0 );
function rooms_taxonomy(){
$labels = array(
'name' => _x( 'Room Category', 'taxonomy general name' ),
'singular_name' => _x( 'Room Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Room Categories' ),
'all_items' => __( 'All Room Categories' ),
'parent_item' => __( 'Parent Room Category' ),
'parent_item_colon' => __( 'Parent Room Category:' ),
'edit_item' => __( 'Edit Room Category' ),
'update_item' => __( 'Update Room Category' ),
'add_new_item' => __( 'Add New Room Category' ),
'new_item_name' => __( 'New Room Category' ),
'menu_name' => __( 'Room Categories' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_in_menu' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'rooms', 'with_front' => false ),
'_builtin' => false
);
register_taxonomy( 'room_category', 'rooms', $args );
}
However when I try to visit the url on my website:
http://www.upperhouse.org/rooms
I am getting a 404 error. Shouldn't this be the landing page for the taxonomy? Very confused here. Thanks for any help!