I have uploaded a file called page-testtest.php to my template folder. Aren’t I supposed to get to this file when I go to example.com/testtest

It seems very strange to me because the documentation clearly states that I should go to that file without any struggle. Instead I get “Oops! That page can’t be found.”

By the way the permalink is set as: https://example.com/sample-post/ and I use Underscores template

Before somebody bravely refer me to the documentation this is from https://developer.wordpress.org/themes/template-files-section/page-template-files

page-{slug}.php — If no custom template has been assigned, WordPress looks for and uses a specialized template that contains the page’s slug.

2 Answers
2

A template is not a page you can load directly. A template is used for the formatting (‘building’) of a ‘page’ (created via Page, Add) or ‘post’ (created via Post, Add).

On that page/post editing page, there is a place to specify the template that the WP will use when the page is output. There are default templates used (see Template Hierarchy) for posts/pages.

But you can’t call (load into your browser) a template file directly. The template file is sort of ‘output instructions’ that WP uses to build the actual page (or post).

Leave a Reply

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