[wp-trac] [WordPress Trac] #10441: Show warning when deprecated hook is registered

WordPress Trac noreply at wordpress.org
Thu May 19 02:12:18 UTC 2016


#10441: Show warning when deprecated hook is registered
------------------------------------+---------------------------
 Reporter:  sirzooro                |       Owner:  boonebgorges
     Type:  feature request         |      Status:  accepted
 Priority:  normal                  |   Milestone:  4.6
Component:  Plugins                 |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |     Focuses:
------------------------------------+---------------------------
Changes (by boonebgorges):

 * owner:  DrewAPicture => boonebgorges
 * milestone:  Future Release => 4.6


Comment:

 In addition to #34195, there are a number of hooks in WP that are
 documented as deprecated where this could be used. So let's put it in.

 [attachment:10441.2.diff] is a refresh makes the following changes:

 * Add unit tests.
 * Use `do_action_ref_array()` and `apply_filters_ref_array()` in the
 wrappers, to simplify the syntax.
 * I changed the names of the functions from `do_deprecated_action()` to
 `do_action_deprecated()`. IMO this makes it clearer that the function is
 related to `do_action()`. And in the case of `apply_filters()`, it feels
 more semantically correct - filters (ie callbacks) are being applied to a
 value; it's not the callbacks that we're deprecating, it's the use of the
 hook. Anyway, I don't care very much about this, so if anyone feels
 strongly the other way, it can be changed back.
 * Added the `deprecated_hook_run` action for getting a stack trace. The
 previous patch mentioned an action `deprecated_hook_used` for this purpose
 but didn't define it. I understand why one think `used` is more precise,
 but since all the other `_deprecated` functions have `_run` hooks, we
 should do it here too.

 Feedback welcome.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/10441#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list