I have 2 custom post types in my WordPress theme, and never had any problems before when both are set to;
'public' => 'true'
However on this occasion, whenever I set one to true the other one refused to load the template and I a 404 error, I've flushed the cache and still no success.
I've checked through the code and can't see any errors.
add_action("init", "custom_post_type_menu_wp_admin");
function custom_post_type_menu_wp_admin() {
register_post_type('developments',
array(
'label' => __('Developments','templatic'),
'labels' => array(
'name' => __('Developments','templatic'),
'singular_name' => __('Developments','templatic'),
'add_new' => __('Add Developments','templatic'),
'add_new_item'=> __('Add New Developments','templatic'),
'edit' => __('Edit','templatic'),
'edit_item'=> __('Edit Developments','templatic'),
'new_item' => __('New Developments','templatic'),
'view_item' => __('View Developments','templatic'),
'search_items' => __('Search Developments','templatic'),
'not_found' => __('No Developments','templatic'),
'not_found_in_trash'=> __('No Developments found in trash','templatic')
),
'public' => true,
'can_export' => true,
'show_ui' => true,
'_builtin' => false,
'_edit_link' => 'post.php?post=%d',
'capability_type' => 'post',
'menu_icon' => 'dashicons-hammer',
'hierarchical' => false,
'rewrite' => array(
"slug" => "developments",
"with_front" => false
),
'query_var' => "true",
'supports' => array(
'title'
),
'show_in_nav_menus' => true
)
);
register_post_type('house_types',
array(
'label' => __('House Types','templatic'),
'labels' => array( 'name' => __('House Types','templatic'),
'singular_name' => __(
'House Types','templatic'),
'add_new' => __('Add House Types','templatic'),
'add_new_item'=> __('Add New House Types','templatic'),
'edit' => __('Edit','templatic'),
'edit_item'=> __('Edit House Types','templatic'),
'new_item' => __('New House Types','templatic'),
'view_item' => __('View House Types','templatic'),
'search_items' => __('Search House Types','templatic'),
'not_found' => __('No House Types','templatic'),
'not_found_in_trash'=> __('No House Types found in trash','templatic')
),
'public' => true,
'can_export' => true,
'show_ui' => true, // UI in admin panel
'_builtin' => false, // It's a custom post type, not built in
'_edit_link' => 'post.php?post=%d',
'capability_type' => 'post',
'menu_icon' => 'dashicons-admin-multisite',
'hierarchical' => false, // Sets parent, child effect. Needs 'page-attributes' setting up
'rewrite' => array(
"slug" => "house-types",
"with_front" => false
), // Permalinks
'query_var' => "true", // This goes to the WP_Query schema
'supports' => array(
'title'
) ,
'show_in_nav_menus' => true
)
);
}
Can anyone spot what's gone wrong on this occasion, please?
Thanks in advance!