here is my problem. It’s been around 2 hours that I try to have a page listing all projects (they are a Custom Post Type) so I’m trying to have an archive file named archive-projects.php but when I try to access it with /projects/ , it redirects me to the home.php instead of a 404 error. I’m kinda lost there.
This is my register_post_type maybe it can help.

function projetPostType()
    {
        register_post_type('projects',
            array(
                'labels' => array(
                    'name' => __('Projects'),
                    'singular_name' => __('Project'),
                    'add_new' => __('Add project'),
                    'add_new_item' => __('Add project'),
                    'edit' => __('Edit'),
                    'edit_item' => __('Edit project'),
                    'new_item' => __('New project'),
                    'view' => __('View project'),
                    'view_item' => __('View the project'),
                    'search_items' => __('Search project'),
                    'not_found' => __('No project')
                ),
                'hierarchical' => false,
                'public' => true,
                'menu_position' => 30,
                'has_archive' => true,
                'rewrite' => array('slug' => 'projects'),
                'supports' => array('title', 'editor', 'thumbnail'),
                'description' => 'Project contains a text and title',
                'exclude_from_search' => true,
                'publicly_queryable' => false,
                'show_in_admin_bar' => true,                                            
                'register_meta_box_cb' => 'gererBoiteProjets'
            )
        );
    }

I don’t have any plugin so it’s not coming from there. If you need more informations, feel free to ask.

3 Answers
3

Flush your permalinks – by which I mean simply visit the Permalinks page under Settings.

Then check /projects again.

EDIT:

Remove

'publicly_queryable' => false,

from your arguments. It prevents rewrites.

Leave a Reply

Your email address will not be published. Required fields are marked *