A simple, practical foundation for building WordPress plugins faster and more reliably.
Instead of starting from scratch every time you build a WordPress plugin, this library provides the essential building blocks you need:
- Solid foundation for plugin structure and lifecycle
- Simple hook system that eliminates boilerplate code
- Template engine for clean HTML/PHP separation
- API builder for creating REST endpoints easily
- Helpful utilities for common WordPress tasks
Simple, practical guides are available in the docs/ folder:
- Getting Started - Quick setup and overview
- Plugin Foundation - Main plugin structure
- Hooks and Actions - Easy WordPress hook integration
- Templates and Views - Display logic and HTML templates
- API Endpoints - REST API creation
- Utilities - Helper functions and tools
Building WordPress plugins involves a lot of repetitive setup code. This library handles the boring stuff so you can focus on your plugin's unique functionality.
Before:
// Lots of manual hook registration
add_action('init', [$this, 'init']);
add_filter('the_content', [$this, 'modifyContent']);
add_action('wp_ajax_my_action', [$this, 'handleAjax']);
// ... and so onAfter:
/**
* @action init
*/
public function init() { }
/**
* @filter the_content
*/
public function modifyContent($content) { }
/**
* @ajax my_action
*/
public function handleAjax() { }Clean, simple, and less error-prone.
- Extend the
Pluginclass in your main plugin file - Use annotations in your methods to register hooks
- Call
YourPlugin::load()to initialize your plugin
<?php
use GreatScottPlugins\WordPressPlugin\Plugin;
class MyPlugin extends Plugin {
/**
* @action init
*/
public function initialize() {
// Plugin initialization code
}
/**
* @filter the_content
*/
public function modifyContent($content) {
return $content . ' - Modified by MyPlugin';
}
}
// Load the plugin
MyPlugin::load();- PHP 7.4 or higher
- WordPress (any recent version)
- PSR-4 autoloading (via Composer)