[wp-trac] [WordPress Trac] #43621: Introduce `add_action_once` and `add_filter_once` sugar.
WordPress Trac
noreply at wordpress.org
Fri Apr 6 17:12:30 UTC 2018
#43621: Introduce `add_action_once` and `add_filter_once` sugar.
-------------------------------------------------+-------------------------
Reporter: soulseekah | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting
Component: Plugins | Review
Severity: normal | Version:
Keywords: has-patch has-unit-tests dev- | Resolution:
feedback | Focuses:
-------------------------------------------------+-------------------------
Comment (by soulseekah):
@vortfu Thanks for looking at this. Indeed, the bug stems from the fact
that adding a callback with the same name is not possible.
`_wp_filter_build_unique_id` returns the same ID for it, so
`_remove_filter_once` is not actually added a second time.
> could be re-implemented as an anonymous func
PHP 5.2 does not support anonymous functions, unfortunately. Thus the
crazy hacking :) (and bugs).
43621.2.diff contains both the 43621.wp_hook.diff patch and fixes on
43621.once.diff.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43621#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list