# Hide Elementor Templates From Non-Administrators

> Removes the Templates menu Elementor adds to wp-admin for everyone except administrators and blocks direct access to the list, protecting headers, footers and popups.

- Type: PHP
- Runs: Admin only
- Category: [Page Builders & Themes](https://wpide.com/library/category/page-builders/)
- Tags: elementor, templates, roles, admin
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/elementor-templates-menu-admins-only/

## Code

```php
// Capability required to manage templates.
$wpide_el_templates_capability = 'manage_options';

add_action( 'admin_menu', function () use ( $wpide_el_templates_capability ) {
    if ( ! current_user_can( $wpide_el_templates_capability ) ) {
        remove_menu_page( 'edit.php?post_type=elementor_library' );
    }
}, 999 );

add_action( 'load-edit.php', function () use ( $wpide_el_templates_capability ) {
    if ( isset( $_GET['post_type'] ) && 'elementor_library' === $_GET['post_type'] && ! current_user_can( $wpide_el_templates_capability ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
        wp_die( esc_html__( 'Sorry, you are not allowed to access this page.' ), 403 );
    }
} );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide Elementor 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/
