# Hide Selected Page Templates From Non-Administrators

> Removes chosen templates, such as a landing page or a blank canvas, from the template picker for editors and authors, so only administrators can apply layouts that need care.

- Type: PHP
- Runs: Run everywhere
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: templates, permissions, pages
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/hide-page-templates-non-admins/

## Code

```php
// Templates only administrators may choose.
$wpide_admin_only_templates = array( 'blank', 'template-landing.php', 'page-no-title' );

add_filter( 'theme_page_templates', function ( $templates ) use ( $wpide_admin_only_templates ) {
    if ( current_user_can( 'manage_options' ) ) {
        return $templates;
    }
    return array_diff_key( $templates, array_flip( $wpide_admin_only_templates ) );
} );
```

## Notes

List template file names (classic themes, such as template-landing.php) or slugs (block themes, such as blank) in $wpide_admin_only_templates; pages already using them keep working.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide Selected Page Templates From Non-Administrators" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
