My Plugin
Boilerplate starter plugin for WordPress - custom post type, REST API, and admin settings page stubs, ready to rename and extend.
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/hiral262/my-plugin/archive/refs/heads/main.zipBoilerplate starter plugin for WordPress — a clean, WPCS-compliant scaffold to rename and build on top of.
Features
- Custom post type stub (
mp_item— "Items") - REST API endpoint stub —
GET /wp-json/my-plugin/v1/items - Admin Settings page under the CPT menu, built with the WordPress Settings API
- Activation / deactivation hooks (default options, rewrite flush)
uninstall.phpcleanup handler that removes plugin options on delete- One class per responsibility under
includes/, following WordPress Coding Standards
Requirements
- WordPress 5.8+
- PHP 7.4+
Installation
- Download or clone this repository into
wp-content/plugins/my-plugin. - Activate My Plugin from Plugins → Installed Plugins.
- Go to My Plugin → Settings to configure the example option.
Project structure
my-plugin/
├── my-plugin.php # Main plugin file — headers, constants, hooks, bootstrap
├── uninstall.php # Removes plugin options on uninstall
├── includes/
│ ├── class-post-type.php # Registers the "Item" custom post type
│ ├── class-rest-api.php # Registers the /my-plugin/v1/items REST route
│ └── class-admin-page.php # Settings page (Settings API)
├── assets/
│ ├── admin.css
│ └── admin.js
└── languages/ # .pot/.po/.mo translation files
Using this as a starter
This scaffold is meant to be renamed and extended:
- Rename the
my-pluginfolder andmy-plugin.phpfile. - Update the plugin header (
Plugin Name,Text Domain, etc.) inmy-plugin.php. - Replace the
MP_constant prefix,mp_function prefix, andMP_*class prefix with your own. - Update the text domain (
my-plugin) throughout, and inreadme.txt. - Remove or extend the example custom post type, REST route, and settings page for your actual feature.
License
GPL-2.0-or-later — see LICENSE.