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?
Thanks
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 apage-profile.php
in your theme, or you can usepage-21.php
where21
is the ID of that page/post.Sorry, but this is not (longer) possible (as the
page_template
filter seems to have been removed with the introduction of theWP_Theme
class).The
get_templates_dropdown()
function that calls the templates inside the meta box callsget_page_templates()
which then has this builder function inside:And this function comes without any sort of filter or hook.