# Stop Non-Administrators Changing Content Widths

> Hides the content width and wide width fields in the layout settings of Group and similar blocks for everyone except administrators, so page widths stay consistent.

- Type: PHP
- Runs: Run everywhere
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: theme-json, layout, permissions
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/themejson-lock-content-widths/

## Code

```php
add_filter( 'wp_theme_json_data_theme', function ( $theme_json ) {
    if ( current_user_can( 'manage_options' ) ) {
        return $theme_json;
    }

    return $theme_json->update_with( array(
        'version'  => WP_Theme_JSON::LATEST_SCHEMA,
        'settings' => array(
            'layout' => array( 'allowCustomContentAndWideSize' => false ),
        ),
    ) );
} );
```

## Notes

Needs WordPress 6.6+; older versions ignore the setting.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Stop Non-Administrators Changing Content Widths" 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/
