0

My permalink is set to a custom structure: /blog/%year%/%monthnum%/%day%/%postname%/

I have a custom post type we'll call "post-type". I also have an archive page named archive-post-type.php

Accessing domain.com/post-type/ though is defaulting to archive.php and skipping archive-post-type.php

My register_post_type looks like this:

    register_post_type( 'ch_post_type',
    array(
        'labels' => array(
            .......
        ),
    'public' => true,
    'has_archive' => 'post-type',
    'show_in_nav_menus' => false,
    'menu_position' => 100,
    'menu_icon' => 'dashicons-category',
    'supports' => array('title','editor','custom-fields'),
    'rewrite' => array( 'slug' => 'post-type', 'with_front' => false ),
    'hierarchical' => true
    )
);

Under Settings > Reading, I have a Page set up for Home and Blog.

I've flushed my permalinks as well.

I know others have had this problem and I have not yet seen an answer that solves it. I'm on version 3.9

Thank you in advance!

1
  • Apart from the answer, I would not use underscores in the post type name. Rather just use normal hypens. Apr 29, 2014 at 11:36

1 Answer 1

3

Try making your has_archive set to just boolean true.

1
  • Thanks, man. I realized how irrelevant that extra info I gave.
    – Pi Lover
    Apr 29, 2014 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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