Using a page template without a page

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.

Read More

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)?

Related posts

Leave a Reply

1 comment

  1. 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") {
        remove_menu_page('edit.php?post_type=critical_post_type');
    }
    

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