Decoupled WordPress Hooks (filters and actions)

1.0.7 2024-03-16 11:11 UTC

This package is auto-updated.

Last update: 2024-05-16 11:27:47 UTC


README

Simple copy of WordPress' WP_Hook class with some adjustments to use outside of WordPress.

No dependencies!

Why?

Because I like these WordPress "filters" and they "cost" almost nothing. And sine I use them in other projects it's easier to make them public anyways.

Usage

Via composer

composer require simplemediacode/hooks

and then

use SimpleMediaCode\Hooks\WP_Hook;

See ActionHooks.php in example folder (which is autoloaded too). Or wrap in your own solution. I use them inside classes and/or in helper functions. Should be compatible with WordPress (works on my machine). "Tested" with PHP 8.2.22.

Changelog

Read at CHANGELOG.md.

Links

More about how to use WordPress hooks (filters and actions) read at wordpress.org: "WP_Hook: Next Generation Actions and Filters". Instead of $wp_* here use $wphook_* for compatiblity.

Thanks to WordPress team and collaborators

Most of job done by WordPress team and collaborators

License

This library is released under the GLP-2 license. See the complete license in the bundled LICENSE file.