Skip to content

Instantly share code, notes, and snippets.

@vburlak
Last active September 7, 2022 12:49
Show Gist options
  • Select an option

  • Save vburlak/9928afdb11d4584a3a620ecbeb67fa0d to your computer and use it in GitHub Desktop.

Select an option

Save vburlak/9928afdb11d4584a3a620ecbeb67fa0d to your computer and use it in GitHub Desktop.

Revisions

  1. vburlak renamed this gist Sep 7, 2022. 1 changed file with 0 additions and 0 deletions.
  2. vburlak created this gist Sep 7, 2022.
    13 changes: 13 additions & 0 deletions getDefaultBlockNames.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    // grab all block types
    const types = wp.blocks.getBlockTypes();

    // filter to just the core blocks
    const core_blocks = types.filter(
    type => type.name.startsWith( 'core/' )
    );

    // grab just the names
    const block_names = core_blocks.map( type => type.name );

    // display in the console
    console.log( block_names );