Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

404 on Custom Post Type Taxonomy Archive WordPress

Hello,

Here's the code for the custom post type and it's custom taxonomy:

function pc_calendar_post_type() {
$labels = array(
'name' => _x('Calendars', 'post type general name'),
'singular_name' => _x('Calendar', 'post type singular name'),
'add_new' => _x('Add New', 'calendar'),
'add_new_item' => __('Add New Calendar'),
'edit_item' => __('Edit Calendar'),
'new_item' => __('New Calendar'),
'all_items' => __('All Calendars'),
'view_item' => __('View Calendar'),
'search_items' => __('Search Calendars'),
'not_found' => __('No calendars found'),
'not_found_in_trash'=> __('No calendars found in Trash'),
'parent_item_colon' => '',
'menu_name' => __('Calendars')

);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable'=> true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array(
'slug' => 'calendars',
'with_front' => false
),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title','thumbnail','editor','excerpt' )
);
register_post_type('pc-calendar',$args);
}
add_action( 'init', 'pc_calendar_post_type', 0 );

// REGISTER TAX
$labels = array(
'name' => _x( 'Categories', 'taxonomy general name' ),
'singular_name' => _x( 'Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Categories' ),
'popular_items' => __( 'Popular Categories' ),
'all_items' => __( 'All Categories' ),
'edit_item' => __( 'Edit Category' ),
'update_item' => __( 'Update Category' ),
'add_new_item' => __( 'Add New Category' ),
'new_item_name' => __( 'New Category Name' ),
'add_or_remove_items' => __( 'Add or remove categories' ),
'menu_name' => __( 'Categories' ),
);

register_taxonomy('cal-categories','pc-calendar',array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'our-calendars' ),
));


I'm working from the IP address and here's the link to the calendars page: http://173.236.7.160/~polestar/our-calendars/

If you click any one of the 3 categories on that page you'll be redirect to the 404 page. You can also navigate to the custom taxonomy archive pages by using the submenu under 'Our Calendars' in the main nav.

This is really odd cause it was working fine last week and nobody has touched the code or moved products out of categories.

Visiting the permalinks page doesn't seem to work.

The file I'm using for these categories is the index.php file.

Thanks for the help.

Answers (5)

2012-09-24

Michael Caputo answers:

It looks like your url should be
http://173.236.7.160/~polestar/calendars/


Denis Leblanc comments:

You're right, I did recently change the slug to that and forgot to update it in the code. However, the global nav links were correct yet still spitting out the 404.





Denis Leblanc comments:

Looks like it's resolved now somehow.

Gawd!?


Michael Caputo comments:

Glad to hear it

2012-09-24

Luis Abarca answers:

Did youy flush your rewrite rules ??

Visit Permalinks to do that or add flush_rewrite_rules()


Luis Abarca comments:

function pc_calendar_post_type() {

$labels = array(

'name' => _x('Calendars', 'post type general name'),

'singular_name' => _x('Calendar', 'post type singular name'),

'add_new' => _x('Add New', 'calendar'),

'add_new_item' => __('Add New Calendar'),

'edit_item' => __('Edit Calendar'),

'new_item' => __('New Calendar'),

'all_items' => __('All Calendars'),

'view_item' => __('View Calendar'),

'search_items' => __('Search Calendars'),

'not_found' => __('No calendars found'),

'not_found_in_trash'=> __('No calendars found in Trash'),

'parent_item_colon' => '',

'menu_name' => __('Calendars')



);

$args = array(

'labels' => $labels,

'public' => true,

'publicly_queryable'=> true,

'show_ui' => true,

'show_in_menu' => true,

'query_var' => true,

'rewrite' => array(

'slug' => 'calendars',

'with_front' => false

),

'capability_type' => 'post',

'has_archive' => true,

'hierarchical' => false,

'menu_position' => null,

'supports' => array( 'title','thumbnail','editor','excerpt' )

);

register_post_type('pc-calendar',$args);
<strong>flush_rewrite_rules();</strong>
}

2012-09-24

Martin Pham answers:

please re-save Permalink on wp-admin/options-permalink.php

2012-09-24

Jatin Soni answers:

Have you tried to flush permalink?

Just try by Settings > Permalink hit save button couple of time and check again

2012-09-24

Arnav Joy answers:

I check it and it is not redirecting to 404 but it is displaying the content .