Skip to content

Instantly share code, notes, and snippets.

@rocket-martue
Created December 5, 2021 13:39
Show Gist options
  • Save rocket-martue/8e706c2657521b0dd08cec22747861c4 to your computer and use it in GitHub Desktop.
Save rocket-martue/8e706c2657521b0dd08cec22747861c4 to your computer and use it in GitHub Desktop.
JavaScriptで不要なブロックを非表示にする (ブラックリスト形式)
wp.domReady( () => {
const unregisterBlocks = [
'core/freeform',
'core/pullquote',
'core/verse',
];
unregisterBlocks.forEach( blockName => {
wp.blocks.unregisterBlockType( blockName );
} );
const unregisterEmbedBlocks = [
'twitter',
'youtube',
'wordpress',
];
unregisterEmbedBlocks.forEach( blockName => {
wp.blocks.unregisterBlockVariation( 'core/embed', blockName );
} );
} );
@rocket-martue
Copy link
Author

埋め込みブロックは、unregisterEmbedBlocksの方に指定する。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment