Page is defaulting to archive page and not designated template

  1. I created a page called “Projects” through the wordpress admin
  2. I created a template called “Projects”
  3. Set the “Projects” page to use the Projects template.

How come when I navigate to the Projects page it shows the archive page and not the Projects template.

Also, if I set the “posts page” in settings->reading to “Projects” in the admin then the above happens. But, if I don’t set a post page then I can go to the /Projects and this works fine. However, if I go to /projects (lowercase) then this doesn’t work and it defaults to the archive page.

Read More

I’m confused as to what is going on, can anyone help?

Related posts

Leave a Reply

4 comments

  1. This conflict normally happens when a custom post type archive and a normal wordpress page has the same slug. The custom post type archive has the higher priority here.

    If you have a custom post type by the name ‘Projects’ and ‘has_archive’ is set to true for the custom post type then the conflict will arise. Set ‘has_archive’ to false so that it shows the page template. Or you could also create a archive-[post-type].php and style it in accordance with your portfolio page template.

  2. If you are using CPT UI, you can change the archive slug:
    archive conflict with page wordpress

    Or if you’re using register_post_type(), add this:

    'rewrite' => array( 'slug' => 'products-archive' ),
    
  3. In my case, my custom-post was with a slug “projects” and the slug of my projects was “2016”, “2017” or “2018”, single projects were not reachable ( ex: /projects/2017 ) and go directly to the custom post type archive,

    After changing the slug of the project to “project-2017”, projects were reachable …

    I think there is a conflict when the slug is only a number …

  4. I’ve faced the issue on my committees’ page, I also had a post-type committee with the same slug. Changing the slug of the page or post type will resolve your problem and also you can change has_archive => false.

    <i>    register_post_type( 'committies',
        // CPT Options
            array(
                'labels' => array(
                    'name' => __( 'Committees ' ),
                    'singular_name' => __( 'Committees ' )
                ),
                'public' => true,
                'menu_icon'           => 'dashicons-admin-users',
                'has_archive' => false,
                'rewrite' => array('slug' => 'committie'),
                **'show_in_rest' => true,**
                'supports'            => array( 'title',   'thumbnail',  'revisions',    ),
      
            )
        );</i>