I made a custom page template (for example, for About page), added Template Name inside the file and saved that. Then I tried to add a page in wp admin console using that template. It said that the page had been created successfully but when I try to open it in browser, it shows me 404 error. What did I do wrong?
Thanks.
I forgot to say that I set up permalinks to be /%postname%/ and then it give me that error. If I use no permalinks (default setting), it show the page normally.
Friends,
I made a single change to the custom template and it fixed the above issue.
Instead of
require_once('./wp-blog-header.php');
in the custom page for including WordPress theme,I used this,
require_once('./wp-load.php');
That fixed me the problem.
Please let me know if its working for you. I spent hours tracking and fixing this up for theworksheets.com
I think the problem is nothing to do with your custom template, but your permalink structure.
It’s not really recommended to just use
/%postname%/
– quoting from the Codex;What’s the slug (the ‘sanitized’ title used in the URL) of the problem page?
Make sure you’ve rebooted Apache after editing the config file.
Also check there is a
.htaccess
file (no filename, with an extension ‘htaccess’) in your WordPress root, and that it contains;