wp scaffold plugin

Generates starter code for a plugin.

Generated Files

Always generated:

  • plugin-slug.php – Main PHP plugin file
  • readme.txt – Readme file for the plugin
  • package.json – NPM metadata with grunt, grunt-wp-i18n, grunt-wp-readme-to-markdown
  • Gruntfile.js – Grunt tasks: i18n (addtextdomain, makepot), readme (wp_readme_to_markdown)
  • .editorconfig – Editor configuration
  • .gitignore – Git ignore patterns
  • .distignore – Distribution ignore patterns

Unless --skip-tests is used:

  • phpunit.xml.dist – PHPUnit configuration
  • .circleci/config.yml – CircleCI configuration (or other CI via --ci)
  • bin/install-wp-tests.sh – WordPress test suite setup
  • tests/bootstrap.php – Test bootstrap file
  • tests/test-sample.php – Sample test cases
  • .phpcs.xml.dist – PHP_CodeSniffer rules

Synopsis

bash
wp scaffold plugin <slug> [--dir=<dirname>] [--plugin_name=<title>] [--plugin_description=<description>] [--plugin_author=<author>] [--plugin_author_uri=<url>] [--plugin_uri=<url>] [--skip-tests] [--ci=<provider>] [--activate] [--activate-network] [--force]

Options

The internal name of the plugin.

[–dir=] Put the new plugin in some arbitrary directory path. Plugin directory will be path plus supplied slug.

[–plugin_name=<title>] What to put in the ‘Plugin Name:’ header.

[–plugin_description=] What to put in the ‘Description:’ header.

[–plugin_author=] What to put in the ‘Author:’ header.

[–plugin_author_uri=] What to put in the ‘Author URI:’ header.

[–plugin_uri=] What to put in the ‘Plugin URI:’ header.

[–skip-tests] Don’t generate files for unit testing.

[–ci=] Choose a configuration file for a continuous integration provider.

  • default: circle
  • options: circle, gitlab, bitbucket, github

[–activate] Activate the newly generated plugin.

[–activate-network] Network activate the newly generated plugin.

[–force] Overwrite files that already exist.

Examples

bash
$ wp scaffold plugin sample-plugin
Success: Created plugin files.
Success: Created test files.