# Remove Formatting Buttons From the Block Toolbar

> Removes rarely needed formatting options, such as text color highlight, inline image, keyboard input and language, from the rich text toolbar.

- Type: PHP
- Runs: Admin only
- Category: [Block Editor](https://wpide.com/library/category/gutenberg/)
- Tags: formatting, toolbar, editor
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/remove-rich-text-formats/

## Code

```php
// Formats to remove from the toolbar.
$wpide_removed_formats = array( 'core/text-color', 'core/image', 'core/keyboard', 'core/language' );

add_action( 'enqueue_block_editor_assets', function () use ( $wpide_removed_formats ) {
    wp_add_inline_script(
        'wp-rich-text',
        'wp.domReady(function(){(window._wpLoadBlockEditor||Promise.resolve()).then(function(){' . wp_json_encode( array_values( $wpide_removed_formats ) ) . '.forEach(function(name){if(wp.data.select("core/rich-text").getFormatType(name)){wp.richText.unregisterFormatType(name);}});});});'
    );
} );
```

## Notes

Format names include core/text-color, core/image, core/keyboard, core/language, core/subscript, core/superscript, core/code and core/strikethrough.

## How to use it

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