The absolute minimal WordPress plugin template. Just the essentials - activation, deactivation, and code quality tools.
- WordPress Coding Standards - WPCS with PHP_CodeSniffer for WordPress coding standards compliance
- EditorConfig - Consistent editor settings across different IDEs
- Minimal Structure - Just the bare essentials, no bloat
- Plugin Hooks - Basic activation and deactivation hooks ready to use
Click "Use this template" on GitHub or clone this repository:
git clone https://github.com/liasoft/template-wp-plugin.git my-new-plugin
cd my-new-plugin
rm -rf .git && git init # Start fresh git historyThe easiest way to customize this template is using the initialization script:
- Edit
template.jsonwith your plugin details:
{
"plugin": {
"name": "My Awesome Plugin",
"slug": "my-awesome-plugin",
"description": "Does awesome things for WordPress.",
"version": "1.0.0",
"uri": "https://github.com/yourname/my-awesome-plugin"
},
"author": {
"name": "Your Name",
"uri": "https://yourwebsite.com"
},
"php": {
"namespace": "MyAwesomePlugin",
"function_prefix": "my_awesome_plugin",
"constant_prefix": "MY_AWESOME_PLUGIN"
},
"composer": {
"name": "yourname/my-awesome-plugin"
},
"github": {
"owner": "yourname",
"repo": "my-awesome-plugin"
}
}- Run the initialization script:
# Preview changes (dry run)
python scripts/init-repo.py --dry-run
# Apply changes (resets changelog by default)
python scripts/init-repo.py
# Apply changes but keep existing changelog
python scripts/init-repo.py --keep-changelogThe script will:
- Replace all template placeholders across all files
- Rename
template-wp-plugin.phptoyour-plugin-slug.php - Update version validation scripts
- Reset the changelog for a fresh start (use
--keep-changelogto preserve it)
Alternatively, you can manually customize:
-
Rename the main plugin file:
template-wp-plugin.php→your-plugin-name.php -
Update plugin headers in your renamed file:
Template WordPress Plugin→Your Plugin NameA minimal boilerplate for WordPress plugins→Your plugin descriptionLiasoft GmbH→ Your name- Update all URLs to your repository
-
Update function names to match your plugin (replace
template_wp_pluginprefix) -
Update these files:
composer.json,README.md,CHANGELOG.md,phpcs.xml
composer install# Check code against WordPress Coding Standards
composer run lint
# Auto-fix coding standards violations where possible
composer run lint:fix-
Copy to WordPress plugins directory:
cp -r . /path/to/wordpress/wp-content/plugins/your-plugin-name/ -
Activate in WordPress admin dashboard
-
Your plugin is now active (it doesn't do anything yet - that's the point!)
your-plugin-name/
├── .editorconfig # Editor configuration
├── .github/ # GitHub configuration
│ ├── prompts/ # Copilot workspace prompt files
│ └── workflows/ # CI/CD workflows
├── .gitignore # Git ignore rules
├── assets/ # Plugin assets (banner, icons)
├── scripts/ # Development scripts
│ ├── build-plugin.sh # Build and package plugin
│ ├── init-repo.py # Template initialization script
│ └── validate-versions.sh # Version consistency checker
├── phpcs.xml # WordPress Coding Standards config
├── composer.json # PHP dependencies and scripts
├── composer.lock # Dependency lock file
├── template.json # Template configuration (edit this first!)
├── LICENSE # GPL-3.0-or-later license
├── README.md # This file
├── template-wp-plugin.php # Main plugin file (rename this)
└── vendor/ # Composer dependencies (after install)
- WordPress plugin header with all required metadata
- Direct access prevention
- Plugin activation hook (empty, ready for your code)
- Plugin deactivation hook (empty, ready for your code)
- WordPress Coding Standards: Ensures your code follows WordPress coding standards and best practices
- PHP_CodeSniffer: Automated code standards checking and fixing
- EditorConfig: Consistent code formatting across different editors and IDEs
The template includes workspace-specific prompt files in .github/prompts/ that provide specialized development assistance:
ws-commit.prompt.md- Review and commit changes with proper conventional commit messagesws-review.prompt.md- Code review without committing, focusing on WordPress standardsws-release.prompt.md- Manage plugin versioning and create releases with git tagsws-update.prompt.md- Update and manage Composer dependencies safely
These become available as slash commands in VS Code (e.g., /ws-commit, /ws-review) when using GitHub Copilot. They provide project-specific guidance and automate common WordPress plugin development tasks.
Learn more: How to extend GitHub Copilot with prompt files
The template provides activation and deactivation hooks where you can add your plugin logic:
function template_wp_plugin_activate() {
// Activation logic here.
}
register_activation_hook( __FILE__, 'template_wp_plugin_activate' );
/**
* Plugin deactivation hook.
*/
function template_wp_plugin_deactivate() {
// Deactivation logic here.
}
register_deactivation_hook( __FILE__, 'template_wp_plugin_deactivate' );Add your plugin's main functionality after the hooks:
// Add your plugin code here
// Example: Register shortcodes, add admin menus, enqueue scripts, etc.Important: Remember to rename the functions with your own unique prefix to avoid conflicts with other plugins.
This template follows the principle of absolute minimalism:
- No unnecessary classes or complex architecture
- No assets directory (add only if you need it)
- No admin pages boilerplate (add only if you need it)
- No translation files (add only if you need it)
- No shortcodes or widgets (add only if you need it)
Start simple, add complexity only when needed.
This template is licensed under the GPL-3.0-or-later License.
