# Hide the "Additional CSS Class" Field From Non-Administrators

> Removes the Additional CSS class(es) field from the block Advanced panel for non-administrators, keeping authors to the styles you have designed.

- Type: PHP
- Runs: Run everywhere
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: block-editor, permissions, css
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/no-custom-css-classes-for-non-admins/

## Code

```php
add_filter( 'block_type_metadata', function ( $metadata ) {
    if ( current_user_can( 'manage_options' ) || empty( $metadata['name'] ) ) {
        return $metadata;
    }

    $metadata['supports']                    = isset( $metadata['supports'] ) ? (array) $metadata['supports'] : array();
    $metadata['supports']['customClassName'] = false;

    return $metadata;
} );
```

## Notes

Classes already added to blocks are kept.

## How to use it

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