# Content-Only Editing of Pages for Non-Administrators

> Locks the layout of pages in the block editor for everyone except administrators, so editors can change text and images but cannot move, delete or restyle blocks and break the design.

- Type: PHP
- Runs: Run everywhere
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: block-editor, permissions, layout
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/content-only-editing-for-editors/

## Code

```php
// Post types whose layout is locked.
$wpide_content_only_types = array( 'page' );

add_filter( 'block_editor_settings_all', function ( $settings, $context ) use ( $wpide_content_only_types ) {
    if ( current_user_can( 'manage_options' ) || empty( $context->post ) || ! in_array( $context->post->post_type, $wpide_content_only_types, true ) ) {
        return $settings;
    }

    $settings['templateLock'] = 'contentOnly';

    return $settings;
}, 10, 2 );
```

## Notes

Applies to the post types in $wpide_content_only_types; administrators edit normally.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Content-Only Editing of Pages for 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/
