I have few custom post type, on the single post of which i am getting 404 error page. I think i’ve tried almost every solutions posted on web but still it is not working for me and i’ve started to have a feeling that i have made some other mistake.As i try to debug i have found that each of my custom post have been parsed as ‘attachments’. Please figure it out for me what mistake have i done.
function jnj_register_board_members_posttype ()
{
$labels = array (
'name' => _x ( 'Board Members' , 'jnj' ) ,
'singular_name' => _x ( 'Board Member' , 'jnj' ) ,
'add_new' => _x ( 'New Member' , 'jnj' ) ,
'add_new_item' => __ ( 'New Board Member' , 'jnj' ) ,
'edit_item' => __ ( 'Edit' , 'jnj' ) ,
'new_item' => __ ( 'New Board Member ' ) ,
'all_items' => __ ( 'All Board Members' ) ,
'view_item' => __ ( 'View Board Member' ) ,
'search_items' => __ ( 'Search Board Members' ) ,
'not_found' => __ ( 'No Board Members found' ) ,
'not_found_in_trash' => __ ( 'Board Member not found in Trash' ) ,
'parent_item_colon' => '' ,
'menu_name' => 'Board Member' )
;
$args = array (
'labels' => $labels ,
'public' => true ,
'publicly_queryable' => true ,
'show_ui' => true ,
'show_in_menu' => true ,
'query_var' => true ,
'rewrite' => array( 'slug' => 'board-members', 'with_front' => false),
'capability_type' => 'post' ,
'hierarchical' => false ,
'menu_position' => 5 ,
'menu_icon' => get_stylesheet_directory_uri ( ) . '/images/board-members.png' ,
'register_meta_box_cb'=>'register_board_members_metabox',
'taxonomies' => array ( 'jnj_title' ) ,
'supports' => array ( 'title' , 'editor' , 'thumbnail' , 'custom-fields' , 'excerpt' ) )
;
register_post_type ( 'board_members' , $args );
}
add_action('init', 'jnj_register_board_members_posttype');
Finally I found the solution myself.In case you are also having similar problem, add the following two lines