Skip to content

Instantly share code, notes, and snippets.

@TylerB24890
Created May 3, 2022 19:00
Show Gist options
  • Save TylerB24890/61cdb5e6e2afe6124f7bb0c695e293a3 to your computer and use it in GitHub Desktop.
Save TylerB24890/61cdb5e6e2afe6124f7bb0c695e293a3 to your computer and use it in GitHub Desktop.
Disable Gutenberg Embed Block Variations
const { getBlockVariations, unregisterBlockVariation } = wp.blocks;
wp.domReady(() => {
const allowedEmbedBlocks = ['vimeo', 'youtube'];
getBlockVariations('core/embed').forEach(function (blockVariation) {
if (allowedEmbedBlocks.indexOf(blockVariation.name) === -1) {
unregisterBlockVariation('core/embed', blockVariation.name);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment