Making a site for a client, I have some pages that the client won't be able to edit or delete. These pages rely on specific page templates.

However, I don't want these templates to be available for the client when creating new pages. Is there someway to hide these certain page template from the page attributes dropdown when creating new pages?


2 Answers 2


Rather than defining them as custom page templates, you have an alternative.

Use the page specific templates, e.g. for a profile page, with the slug profile you could create a page-profile.php in your theme, or you can use page-21.php where 21 is the ID of that page/post.

  • Good interim solution, but too bad so sad if you wanted a custom_file_name.php...
    – Adam
    Commented Oct 9, 2012 at 13:10
  • Indeed, though there are methods of removing the need for a post altogether, but I haven't the research to back it up in a comprehensive answer at the moment
    – Tom J Nowell
    Commented Oct 9, 2012 at 13:31

Sorry, but this is not (longer) possible (as the page_template filter seems to have been removed with the introduction of the WP_Theme class).

The get_templates_dropdown() function that calls the templates inside the meta box calls get_page_templates() which then has this builder function inside:


And this function comes without any sort of filter or hook.

  • So I'm left with manually fetching setting in the DB? Or what are my options?
    – INT
    Commented Oct 9, 2012 at 11:38
  • You could maybe rebuild that meta box, unregister the original one, register your own, add your changes to the core function and copypaste that into some custom plugin.
    – kaiser
    Commented Oct 9, 2012 at 11:56
  • This could not be done in PHP, but as the admin is already full of jQuery, maybe you could just use jQuery to dynamically change the DOM of the admin page, removing one item from the dropdown menu.
    – Simon
    Commented Oct 9, 2012 at 20:09
  • @Simon "This could not be done in PHP(...)" this is nonsense.
    – kaiser
    Commented Oct 9, 2012 at 22:12
  • @kaiser : could you explain me in a few word why, considering that there is no simple way of doing it with any built-in function, it's perfect nonsense to do it with jQuery - considering this is not a public-wide modification but will only be used in one instance for a particular individual ?
    – Simon
    Commented Oct 10, 2012 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.