I have a problem with same name (slug) for category and page and wordpress is showing archive.php instead page custom template.

Permalinks settings for category is . and i want to stay this way but to force wordpress to use page on this url address.

Is there any way I can do that?

Category name is "example" so it's url looks like this: example.com/example/ and page name and slug is "example" so it's also example.com/example/ FolderStructure1 FolderStructure2

  • Do you have examples of the URLs for each as well as their slugs? This isn't the clearest at the moment and it's not clear if a precise answer is possible
    – Tom J Nowell
    Oct 4, 2018 at 17:20
  • Hello, i add example
    – Jakub
    Oct 4, 2018 at 17:50
  • and you have a page.php? But it loads archive.php instead? Why is your category permalink set to .?
    – Tom J Nowell
    Oct 5, 2018 at 14:58

1 Answer 1


If you want to force WP then I would recommend to have a look at the template hierarchy

One of the ways you could do it page-$slug

  • Unfortunately it does not work - i change page template name to page-slug but wordpress still use archive.php
    – Jakub
    Oct 4, 2018 at 17:16
  • Just to be clear here, could you tell me ,when you say archive.php, it's pulling taxonomy info or the post_type info?
    – bagpipper
    Oct 4, 2018 at 17:33
  • This is archive of custom post type so probably post_type? Could You tell me how to check it?
    – Jakub
    Oct 4, 2018 at 17:48
  • You can do this by checking the body class, if you have the function [body_class]developer.wordpress.org/reference/functions/body_class It will show you what type of archive it is
    – bagpipper
    Oct 4, 2018 at 18:27
  • Sweet now we know what page it is. Since it's post type archive and you want to show the the page template instead of could can disable the archive feature of the post type by setting has_archive as false where you registered the custom post type
    – bagpipper
    Oct 4, 2018 at 20:01

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.