# Hide the Divi Library From Non-Administrators

> Removes the Divi Library menu (saved layouts, sections and modules) for everyone except administrators, so global elements are not changed by accident.

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

## Code

```php
add_action( 'admin_menu', function () {
    if ( current_user_can( 'manage_options' ) ) {
        return;
    }

    remove_submenu_page( 'et_divi_options', 'edit.php?post_type=et_pb_layout' );
    remove_menu_page( 'edit.php?post_type=et_pb_layout' );
}, 999 );
```

## How to use it

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