Make WordPress Core

Opened 13 years ago

Last modified 11 years ago

#16233 closed defect (bug)

Custom taxonomy archive returns 404 when it contains only custom post types — at Initial Version

Reported by: sillybean's profile sillybean Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Taxonomy Keywords: dev-feedback
Focuses: Cc:

Description

I'm working with a few custom taxonomies that are registered only for a custom post type, not posts or pages. The archive pages return 404s unless I add posts or pages to the taxonomy's content object argument.

Here's the post type:
`
register_post_type(

'course',
array(

'labels' => array(
'name' => ( 'Courses' ),
'singular_name' =>
( 'Course' ),
'add_new' => ('Add New'),
'add_new_item' =>
('Add New Course'),
'edit_item' => ('Edit Course'),
'new_item' =>
('New Course'),
'view_item' => ('View Course'),
'search_items' =>
('Search Courses'),
'not_found' => ('No courses found'),
'not_found_in_trash' =>
('No courses found in Trash'),
'menu_name' => ('Courses'),

),
'capability_type' => 'post',
'map_meta_cap' => true,
'capabilities' => array(

'edit_post' => 'edit_course',
'read_post' => 'read_course',
'delete_post' => 'delete_course',

),
'description' => ('Individual course data'),
'public' => true,
'show_ui' => true,
'hierarchical' => false,
'menu_icon' => get_bloginfo('template_url').'/images/bank.png',
'register_meta_box_cb' => 'course_meta_boxes',
'supports' => array(
'title',
'editor',
'author',
'excerpt',
'custom-fields',
'revisions',)
)

);
`

And one of the taxonomies:

`
register_taxonomy(

'college',
'course',
array(

'labels' => array(
'name' => ( 'Colleges' ),
'singular_name' =>
( 'College' ),
'search_items' => ( 'Search Colleges' ),
'popular_items' =>
( 'Popular Colleges' ),
'all_items' => ( 'All Colleges' ),
'parent_item' =>
( 'Parent College' ),
'parent_item_colon' => ( 'Parent College:' ),
'edit_item' =>
( 'Edit College' ),
'update_item' => ( 'Update College' ),
'add_new_item' =>
( 'Add New College' ),
'new_item_name' => ( 'New College Name' ),
'separate_items_with_commas' =>
( 'Separate colleges with commas' ),
'add_or_remove_items' => ( 'Add or remove colleges' ),
'choose_from_most_used' =>
( 'Choose from the most used colleges' ),
'menu_name' => ('Colleges'),

),
'hierarchical' => true,
)

);
`

Create a few courses, assign them to colleges, and the archives (e.g. /college/liberal-arts) don't work.

If I change the taxonomy definition to include posts (or pages), the archive suddenly work.

`
register_taxonomy(

'college',
'course',
array(

'labels' => array(),

'hierarchical' => true,
)

);
`

Change History (0)

Note: See TracTickets for help on using tickets.