Wordpress plugin base
A baseline plugin by Acentrix, intended as a starting point for custom plugin development. Includes Roots Acorn bootstrapping and lifecycle hooks for Laravel-esque WordPress plugin development.
by Jordan Wilson · github.com/acentrix-jordan/wordpress-plugin-base · website
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/acentrix-jordan/wordpress-plugin-base/archive/refs/heads/main.zipReadme
WordPress Plugin Base
A baseline plugin by Acentrix, intended as a starting point for custom plugin development. Includes Roots Acorn bootstrapping and lifecycle hooks for Laravel-esque WordPress plugin development.
Requirements
- PHP 8.2+
- WordPress 5.2+
- Composer
Getting started
-
Clone (or copy) this repository into
wp-content/plugins/. -
Install dependencies:
composer install -
Activate the plugin from the WordPress admin.
How it works
index.phpregisters the plugin's lifecycle hooks (activation/deactivation) at file scope, then boots Acorn onafter_setup_theme. Lifecycle hooks fire before Acorn's normal boot, so they boot the application on demand viawordpress_plugin_base_boot()before using any Laravel services.constants.phpdefinesPLUGIN_ENTRYand pinsACORN_BASEPATHtosrc/so this plugin's Acorn instance doesn't conflict with other Acorn-based themes or plugins on the same site.src/App/Providers/PluginServiceProvider.phpis the root service provider — register bindings inregister()and hook into WordPress inboot().src/config/holds the Laravel-style config files;src/storage/holds framework caches and logs.
Logging
Laravel logging is configured in src/config/logging.php and writes to:
src/storage/logs/laravel.log
Activation and deactivation events are logged there via the Log facade.
Building a release
./build.sh
This stages the plugin, runs a clean composer install --no-dev --optimize-autoloader, strips dev tooling and runtime artifacts (logs, framework caches, IDE files), and emits an installable zip:
dist/wordpress-plugin-base-<version>.zip
The version is read from the Version: header in index.php. Install the zip via Plugins → Add New → Upload Plugin, or:
wp plugin install dist/wordpress-plugin-base-<version>.zip --activate
Extending
When using this as the base for a new plugin:
- Rename the plugin directory and update the
Plugin Name:/Description:headers inindex.php. - Update the version and bump it for each release before running
./build.sh. - Add service providers under
src/App/Providers/and register them inindex.php'swithProviders([...])call.