WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having a bit of a problem with my custom post types... My post type is called 'videos'. I have all of the posts showing on their single page using the 'single.php' template. But when I take the post name out of the url and keep /videos/, I get a 404 - but I want to list all of the 'videos' here. I tried using archive-videos.php file as the codex reccomends: http://codex.wordpress.org/Post_Types, still with no luck. It also says you can do single-videos.php for custom post types, but this doesn't work either. I'll display the code I use to register my post type below, am I doing something wrong?

add_action('init', 'videos_register');
function videos_register() {
    $labels = array(
        'name' => _x('Videos', 'post type general name'),
        'singular_name' => _x('Video', 'post type singular name'),
        'add_new' => _x('Add New', 'question'),
        'add_new_item' => __('Add New Video'),
        'edit_item' => __('Edit Video'),
        'new_item' => __('New Video'),
        'view_item' => __('View Video'),
        'search_items' => __('Search Videos'),
        'not_found' =>  __('Nothing found'),
        'not_found_in_trash' => __('Nothing found in Trash'),
        'parent_item_colon' => ''
    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title','editor','thumbnail')
    register_post_type( 'videos' , $args );
share|improve this question
up vote 3 down vote accepted

You need to add the arg 'has_archive' => true. Hope this helps!

share|improve this answer
Damn... as easy as that. Much appreciated! – Henryz Sep 21 '11 at 10:46

I was also getting a 404 error when attempting to reference the custom post archives. The following lines solved my problems:

'rewrite' => true,
'has_archive' => true
register_post_type( 'post_type' , $args );    

I also had to make sure my permalink structure was:

share|improve this answer

i also found this link as an alternative http://en.bainternet.info/2011/custom-post-type-getting-404-on-permalinks

share|improve this answer
Welcome to WordPress Stack Exchange! An answer should be more than just a link to an external site. Please add a solution. – toscho Oct 8 '12 at 13:33

Bit late may be but important to mention that …

'has_archive' => 'my-example-archive' // True/False 

… or explicitly mentioning the slug i.e news, events etc and than disable the permalinks and again reactive after saving will solve the issue.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.