# Hide Embed Blocks You Do Not Use

> Keeps only the embed providers you choose, like YouTube and Vimeo, in the block inserter instead of dozens of services.

- Type: PHP
- Runs: Admin only
- Category: [Disable Features](https://wpide.com/library/category/disable-features/)
- Tags: disable, blocks, embeds
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/limit-embed-block-variations/

## Code

```php
// Embed variations to keep in the inserter.
$wpide_keep_embeds = array( 'youtube', 'vimeo', 'spotify' );

add_action( 'enqueue_block_editor_assets', function () use ( $wpide_keep_embeds ) {
    wp_register_script( 'wpide-limit-embeds', false, array( 'wp-blocks', 'wp-dom-ready' ), '1.0', true );
    wp_enqueue_script( 'wpide-limit-embeds' );
    wp_add_inline_script(
        'wpide-limit-embeds',
        sprintf(
            'wp.domReady(function(){var keep=%s;(wp.blocks.getBlockVariations("core/embed")||[]).forEach(function(v){if(keep.indexOf(v.name)===-1){wp.blocks.unregisterBlockVariation("core/embed",v.name);}});});',
            wp_json_encode( array_values( $wpide_keep_embeds ) )
        )
    );
} );
```

## Notes

Pasting a URL from a hidden provider may still create an embed.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide Embed Blocks You Do Not Use" 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/
