I've successfully added a custom post type.

            'labels' => array(
                'name' => __('Cases'),
                'singular_name' => __('Case')
            'public' => true,
            'has_archive' => true,
            'supports' => array('title', 'editor', 'thumbnail','custom-fields', 'page-attributes')


And I've created a page called "case" and I have my permalinks configured like this:


The problem I'm having now is that when I try to access url.com/case I don't get my page "case" but instead I'm looking at the custom post type "case". I think?

Every "case" has its own url --> url.com/case/xxx. I don't want to change this but instead be able to change the layout for the custom page "main" page that represents all the cases instead of a "page" called case.

Can this be done and how?


I got it by searching some more on google.

'has_archive' => true,

This line is vital.

Found out I had to rename my custom template pages to archive-"the custom type name" which in this case was.


Because of this I could remove my "static" page called case and let the system pick the right template page for the custom post type.


In the arguments ($args) parameter of the register_post_type function, there is a variable named rewrite. By default it is true, try to set it to false.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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