For some reason, wordpress is giving me real trouble with custom post types.
I'm using the following code to register the custom post type:
add_action('init', 'codex_custom_init');
function codex_custom_init()
{
flush_rewrite_rules();
$labels = array(
'name' => _x('Communities', 'post type general name'),
'singular_name' => _x('Community', 'post type singular name'),
'add_new' => _x('Add New', 'community'),
'add_new_item' => __('Add New Community'),
'edit_item' => __('Edit Community'),
'new_item' => __('New Community'),
'view_item' => __('View Community'),
'search_items' => __('Search Communities'),
'not_found' => __('No communities found'),
'not_found_in_trash' => __('No communities found in Trash'),
'parent_item_colon' => '',
'menu_name' => 'Communities'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array('slug'=>'comm'),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','author','thumbnail','excerpt','comments')
);
register_post_type('community',$args);
}
I then create a new post as the new custom post type, but when I try and access the post, I get the following:
<strong>Not Found
</strong>
Apologies, but we were unable to find what you were looking for. Perhaps searching will help.
I've also gone to the wordpress dashboard and into settings->permalinks, but when I do that, and navigate to the post, I get an infinite redirect loop.
Any help would be much appreciated. I'm hoping I've made my point clear, but if I haven't, I can provide more details.
Thanks in advance.