This guide is for WordPress developers who want to extend Notifal from a custom plugin, mu-plugin, or theme functions.php.
You do not need to fork Notifal. Use WordPress actions/filters, the REST API, and the DI container helpers documented in this module.
Requirements
| Requirement | Notes |
|---|---|
| WordPress | Same minimum as Notifal (see plugin header) |
| PHP | 7.4+ (8.x supported) |
| Notifal base plugin | Required |
| Notifal Pro | Optional, for Pro-only hooks and features |
Load your code on or after notifal/initialized so all core services exist.
Boot order (base plugin)
Notifal boots on WordPress init priority 0 via Notifal\Bootstrap\Plugin:
- Infrastructure , migrations, admin menu, shared assets (
notifal/infrastructure/servicesfilter) - Tags domain , dynamic tag registry
- Settings domain , global settings
- Feature modules , auto-discovered from
app/Modules/*/ServiceProvider.php notifal/initializedaction fires
add_action( 'notifal/initialized', function () {
// Safe to call notifal_app(), register hooks, REST extensions, etc.
} );
Activation and deactivation fire notifal/activated and notifal/deactivated from Maintenance.php. See Hooks: Lifecycle and Bootstrap.
Boot order (Notifal Pro)
Pro loads on plugins_loaded priority 5, then:
- Pro infrastructure, license, updates, Pro features provider
- Waits for
notifal/initialized, then boots Pro modules fromnotifal-pro/app/Modules/*/ServiceProvider.php - Fires
notifal_pro/initialized
Hook Pro-specific logic after both plugins are ready:
add_action( 'notifal_pro/initialized', function () {
// Pro modules and license gates are available.
} );
Resolving services (DI container)
Use notifal_app( ClassName::class ) to resolve shared services from Notifal's container:
use Notifal\Modules\OnPageNotification\Application\Services\Core\EligibilityService;
add_action( 'notifal/initialized', function () {
$eligibility = notifal_app( EligibilityService::class );
} );
Pro services use notifal_pro_app() when Pro is active.
Each module registers services through AbstractServiceProvider, which:
- Reads a
$servicesarray on the provider class - Applies a module-specific filter (for example
notifal/onpage/services) - Calls
register()andboot()on each service class
How to extend Notifal (recommended paths)
| Goal | Start here |
|---|---|
| Change notification payload before frontend | notifal/onpage/notification/content filter , Cookbook: Modify Notification Before Display |
| Register a custom dynamic tag | notifal/tag/register action , Cookbook: Add Custom Dynamic Tag |
| Register an HTML Builder widget | notifal/template/html_builder/widgets filter, Cookbook: Register a Custom HTML Builder Widget |
| Extend hosted Notifal AI generation | notifal/ai/* filters , Hooks: Hosted Notifal AI |
| Adjust template import result | notifal/template/import/result filter |
| Add admin fields to notification tabs | notifal/admin/onpage/{tab}/before actions |
| Gate or extend Pro features | notifal_pro_* filters , Hooks: Pro Integration Bridge |
| Full hook index | Hook Reference Hub |
| REST integration | REST API Reference |
Source code map
| Area | Path (base plugin) |
|---|---|
| Bootstrap | app/Bootstrap/Plugin.php |
| Hook constants | app/Infrastructure/WordPress/Hooks/ActionHooks.php, FilterHooks.php |
| DI container | app/Core/Foundation/Container.php |
| Service providers | app/Modules/*/ServiceProvider.php |
| REST (on-page) | app/Modules/OnPageNotification/Infrastructure/WordPress/Registration/ApiRegistrar.php |
| Tags REST | app/Domain/Tags/Infrastructure/WordPress/Registration/ |
Pro mirrors the same patterns under notifal-pro/app/.
Conventions
- Hook names use the
notifal/ornotifal_pro/prefix with slash segments. - PHP classes use constants in
ActionHooks/FilterHooks, prefer those over hard-coded strings. - Sanitize all incoming data, escape output, verify nonces on admin/AJAX endpoints.
- Do not enqueue Notifal source asset paths in production; use built files from
build/when bundling alongside Notifal.
What to read next
Developers module
- Getting Started for Developers (you are here)
- Architecture Overview
- REST API Reference
- Hook Reference Hub
- Cookbook series
Related user docs
- What Are Campaigns? , behavior your hooks may depend on
- What Is Notifal? (Free vs Pro) , feature boundaries