Skip to main content
All our blocks go into plugins. You can either have one block per plugin or one plugin that contains multiple blocks. When deciding to add a block to an existing plugin or as a standalone plugin, consider if this plugin is supposed to be available and shared with other sites in the network with the exact same functionality or if it is an opt-in feature that may only be used on a few sites.
Please do not style your blocks with the provided scss files. Use TailwindCSS classes directly in your markup instead.

Creating a new block plugin

In your terminal, navigate to the wp-content/plugins directory and run the following command: Static blocks:
npx @wordpress/create-block my-block
or for dynamic blocks
npx @wordpress/create-block my-block --variant=dynamic
For all options you can visit the official documentation

Creating a new block in an existing plugin

When creating a block plugin for the first time the block files will be inside the src/ directory. When adding additional blocks, you should move these files into their own folder. Example: move src/* to /src/my-first-block/ In your terminal, navigate to the src directory inside of your blocks plugin and run the following command:
npx @wordpress/create-block --no-plugin my-second-block
This will create an additional folder in your src/ folder with the new block files. You then need to open your plugin .php file and make adjustments. Before:
register_block_type( __DIR__ . '/build' );
After:
register_block_type( __DIR__ . '/build/my-first-block' );
register_block_type( __DIR__ . '/build/my-second-block' );