WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know if it's possible to use a page template on a URL, even if a page doesn't exist for that page?

When building sites, I create the relevant pages to ensure use of the templates, but then if the site admins later delete that page, it breaks the site.

I'v read that it's possible to add custom URL rewrites, but is there a way to create a custom URL, but use a regular page template to render up the content (using get_header/footer() & other functions within the page)?

share|improve this question
what's the actual page content? if the page technically doesn't exist, what does the loop output? – Milo Mar 14 '13 at 21:38
Good question, from the back of my head I'd say this is not that straight forward to achieve, at least some code is involved because by default Wordpress selects the templates based on the content-type. – hakre Mar 14 '13 at 22:01
have a look at this post for a potential solution, but it's not so simple to pull off. you'll have a whole bunch of functions to contend with that expect some sort of actual queried object. – Milo Mar 14 '13 at 22:06
I think you're doing it the right way already. Tell them not to delete the page. :) – sam Nov 18 '13 at 6:18
How do these pages look like? What is their content? Could you describe such page? – Krzysiek Dróżdż Nov 19 '13 at 21:20
up vote 1 down vote accepted

What I would advice, and have done myself when making WordPress sites for clients. Create a custom post type that they can’t get access to. You can achieve this by conditionally removing the post type from the admin sidebar. One of the ways to solve that problem is to add a custom capability to the user(s) that you would like to allow editing these critical pages, lets call the capability "edit_ciritical_page" Then in your function.php/file included from function.php/plugin file you say

if (!current_user_can("edit_ciritcal_page") {

If you don’t what to add the custom capability, you could also just check it based on the username/user email.

share|improve this answer
Interesting work around. Thanks for the suggestion. – TobyG Nov 25 '13 at 16:24
By the way, this is indeed secure enough. If one removes a menu page, the user will get "You do not have the permission to access this page" if they do try to access it. – sigsve Dec 15 '13 at 3:51

Your Answer


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.