A command-line interface (CLI) tool for scaffolding WordPress plugin development environments.
- Generate different types of WordPress plugins:
- Classic Plugin (PHP-only)
- Block Plugin (single block with modern JavaScript tooling)
- Block Library (multiple blocks bundled together)
- Official WordPress Block Plugin using @wordpress/create-block
- Optional components:
- Admin Page
- Settings Page
- Environment setup:
- wp-env integration for local development
- wp-now integration for serverless previews
- npm scripts for build tasks
npm install -g wp-plugin-env-gen
npm install wp-plugin-env-gen
wp-plugin-env-gen create
This will start an interactive prompt that will ask you for:
- Plugin Name
- Plugin Slug (auto-generated from name)
- Plugin Description
- Plugin Type (Classic, Block, Block Library, or WordPress create-block)
- For create-block: Block Variant (Static or Dynamic)
- For create-block: Block Namespace
- Whether to include an Admin Page (not applicable for create-block)
- Whether to include a Settings Page (not applicable for create-block)
- Whether to include wp-env configuration
- Whether to include wp-now integration
- Whether to initialize a Git repository
plugin-name/
├── includes/
│ ├── admin/
│ │ └── admin-page.php (if selected)
│ └── settings/
│ └── settings-page.php (if selected)
├── languages/
├── .wp-env.json (if selected)
├── .wp-now.json (if selected)
├── wp-now-setup.sh (if selected)
├── README.md
└── plugin-name.php
plugin-name/
├── build/
├── includes/
│ ├── admin/
│ │ └── admin-page.php (if selected)
│ └── settings/
│ └── settings-page.php (if selected)
├── src/
│ ├── block/
│ │ ├── block.json
│ │ ├── editor.css
│ │ ├── index.js
│ │ └── style.css
│ └── index.js
├── .gitignore
├── .wp-env.json (if selected)
├── .wp-now.json (if selected)
├── wp-now-setup.sh (if selected)
├── package.json
├── README.md
└── plugin-name.php
plugin-name/
├── build/
├── includes/
│ ├── admin/
│ │ └── admin-page.php (if selected)
│ ├── blocks/
│ │ └── example-dynamic.php
│ └── settings/
│ └── settings-page.php (if selected)
├── src/
│ ├── blocks/
│ │ ├── example-static/
│ │ │ ├── block.json
│ │ │ ├── editor.css
│ │ │ ├── index.js
│ │ │ └── style.css
│ │ ├── example-dynamic/
│ │ │ ├── block.json
│ │ │ ├── editor.css
│ │ │ ├── index.js
│ │ │ └── style.css
│ │ └── example-editable/
│ │ ├── block.json
│ │ ├── editor.css
│ │ ├── index.js
│ │ └── style.css
│ └── index.js
├── .gitignore
├── .wp-env.json (if selected)
├── .wp-now.json (if selected)
├── wp-now-setup.sh (if selected)
├── package.json
├── README.md
└── plugin-name.php
The structure follows the official WordPress block plugin template with optional additions:
plugin-name/
├── build/
├── src/
│ ├── blocks/
│ │ └── (varies based on block type)
│ ├── edit.js
│ ├── editor.scss
│ ├── index.js
│ ├── save.js (for static blocks)
│ └── style.scss
├── block.json
├── .wp-env.json (if selected)
├── .wp-now.json (if selected)
├── wp-now-setup.sh (if selected)
├── package.json
├── README.md
└── plugin-name.php
This tool includes integration with the official @wordpress/create-block package, which is the WordPress-recommended way to scaffold block plugins.
When selecting the "Official WordPress Block (@wordpress/create-block)" option, the tool will:
- Use npx to run @wordpress/create-block with your specified options
- Allow you to choose between static and dynamic block variants
- Let you specify a custom namespace for your block
- Optionally add wp-env and wp-now configuration
- Optionally initialize a Git repository
This gives you the best of both worlds: the officially supported WordPress block scaffolding tool with the additional environment setup features of wp-plugin-env-gen.
- Node.js (v14 or later)
- npm (v6 or later)
- Clone this repository
- Run
npm install
to install dependencies - Run
npm link
to create a symlink to the global npm modules
npm start
: Run the CLI tool
MIT