Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

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.

share|improve this answer
    
I just visited the Permalinks section and even clicked "Save" just to be sure but no, still redirect me to home.php –  Stealthunter Aug 21 '13 at 23:44
    
See my edited answer. –  vancoder Aug 22 '13 at 0:16
    
Yeah it worked and realized why it didn'T work, thanks a lot mate ! –  Stealthunter Aug 22 '13 at 12:37
    
The publicly_queryable hint worked for me. Thanks! –  cchiera Nov 26 '13 at 20:39

I faced the same problem with my custom post type. After i flushed the permalink settings, i deleted the the page(which uses the template i created for custom post type) from the pages list and created a new one and used it and it was working fine.

My understanding is that when we flush, we sometimes don't know if they are actually flushed or not.

share|improve this answer

Or, check if the 'Has Archive' checkbox is active.. ashamed ;-)

share|improve this answer
2  
There is no such checkbox in WordPress. Please explain your answer. –  toscho Oct 16 '13 at 17:26

Your Answer

 
discard

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.