WordPress Custom Post Type Archives

I have added the following to my functions.php file

register_post_type( 'news',
 array(
   'labels' => array(
     'name' => __( 'News' ),
     'singular_name' => __( 'News' ),
 'add_new' => __( 'Add New Article' ),
 'add_new_item' => __( 'Add Article' ),
 'edit_item' => __( 'Edit Article' ),
 'new_item' => __( 'New Article' ),
 'view_item' => __( 'View Article' ),
 'search_items' => __( 'Search Articles' ),
 'not_found' => __( 'No Articles Found' ),
 'not_found_in_trash' => __( 'No Articles Found In Trash' ),
 'rewrite' => array(
    'slug' => 'news',
    'with_front' => false
    ),
 'has_archive' => true,
   ),
   'public' => true,
 )

);

Read More

But when i type in news after my site mysite/news/ I get a page not found when it should I gather be listing my archives for news with the has_archives option.

What am I doing wrong!!!

By the way I have an archives.php file

Related posts

Leave a Reply

2 comments

  1. Go into permalinks and save the settings to refresh the permalink structure. WordPress has a problem with the custom post type permalinks you have to do this every time you make a change to you custom post type. This will prevent your from getting a 404 error.