# Block Roles From the Elementor Editor

> Stops the roles you list from opening the Elementor editor, using Elementor's own role exclusion list, while they keep normal access to the WordPress editor.

- Type: PHP
- Runs: Run everywhere
- Category: [Page Builders & Themes](https://wpide.com/library/category/page-builders/)
- Tags: elementor, roles, editor, permissions
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/elementor-block-roles-from-editor/

## Code

```php
// Roles that may not use the Elementor editor.
$wpide_el_blocked_roles = array( 'author', 'contributor' );

$wpide_el_exclude_roles = function ( $value ) use ( $wpide_el_blocked_roles ) {
    $roles = is_array( $value ) ? $value : array();
    $roles = array_merge( $roles, $wpide_el_blocked_roles );

    return array_values( array_unique( array_diff( $roles, array( 'administrator' ) ) ) );
};

add_filter( 'option_elementor_exclude_user_roles', $wpide_el_exclude_roles );
add_filter( 'default_option_elementor_exclude_user_roles', $wpide_el_exclude_roles );
```

## Notes

Role slugs, not names: author, contributor, editor, shop_manager. Administrators can never be excluded.

## How to use it

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