WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #46635, comment 25


Ignore:
Timestamp:
07/12/2019 04:09:18 PM (12 months ago)
Author:
azaozz
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #46635, comment 25

    initial v1  
    77Would that mean the API is "frozen in time" and shouldn't evolve (in a backwards-compatible way)?
    88
    9 Looking at the proposed solutions, seems the API can be enhanced to support removal of closures in a simple and fully backwards-compatible way. For now I like what @schlessera posted in [https://core.trac.wordpress.org/ticket/46635#comment:17 comment 17] the best. Passing a (standardized) object when adding a filter or action is futureproof and very simple to use. Only I'd probably change the name to something related to WP hooks, perhaps `new Add_WP_Action()` with an alias of `Add_WP_Filter()`.
     9Looking at the proposed solutions, seems the API can be enhanced to support removal of closures in a simple and fully backwards-compatible way. For now I like what @schlessera posted in [https://core.trac.wordpress.org/ticket/46635#comment:17 comment 17] the best. Passing a (standardized) object when adding a filter or action is futureproof and very simple to use. Only I'd probably change the name to something related to WP hooks, perhaps `new Add_WP_Action()` with an alias of `Add_WP_Filter()`, or maybe something like `WP_Callback()` or `WP_Hook_Callback()`.
    1010
    1111Then Core will also be able to use closures in hooks, and we can think of a "nice way" to get plugins to switch to it too.
     12