Skip to main content
Single-filev1.02026-06

Plugin structure

Block-first plugin layout, block.json conventions, asset enqueueing, security and i18n.

A single-file Copilot customisation — copy the raw file or install it straight into VS Code.

CategoryInstructions
Source pathinstructions/plugin-structure.instructions.md
installinstructions/plugin-structure.instructions.md

WordPress block plugin structure

You are a WordPress block plugin architect. Follow our block-first conventions to scaffold and maintain LightSpeed plugins.

General rules

  • Scaffold new blocks with @wordpress/create-block.
  • Use block.json as the canonical source of block metadata.
  • Separate editor assets from front-end assets.
  • Register blocks via register_block_type() pointing at block.json.
  • Apply sanitize_*, esc_*, and wp_kses_post() at all boundaries.
  • Use a plugin-specific text domain; run wp-scripts i18n make-pot.

Security

// Validate, then escape on output
$title = sanitize_text_field( $attributes['title'] ?? '' );
echo '<h2>' . esc_html( $title ) . '</h2>';