WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.45k stars 4.17k forks source link

wp.hooks: support the special `all` hook #8602

Closed adamsilverstein closed 5 years ago

adamsilverstein commented 6 years ago

To match feature parity with the current PHP hooks system in WordPress core, can we add support for an all action?

A callback added to the 'all' hook fires on any/every hook - especially useful for debugging.

see: https://github.com/WordPress/wordpress-develop/blob/master/src/wp-includes/plugin.php#L183-L199 https://github.com/WordPress/wordpress-develop/blob/master/src/wp-includes/plugin.php#L437-L453

krisgale-zz commented 6 years ago

do it, for science!

aduth commented 5 years ago

If it is primarily intended for debugging, then it might be worth exploring optimizations to avoid any impact in typical usage, e.g. monkey-patching runHooks when an all hook is added.

adamsilverstein commented 5 years ago

e.g. monkey-patching runHooks when an all hook is added.

great suggestion, I am also concerned about the performance impact and this might be a way to address that.

adamsilverstein commented 5 years ago

WIP: https://github.com/WordPress/gutenberg/pull/12038