[wp-trac] [WordPress Trac] #14280: add_filter should accept an array of tags
WordPress Trac
wp-trac at lists.automattic.com
Wed Aug 15 17:25:15 UTC 2012
#14280: add_filter should accept an array of tags
-------------------------------------------------+-------------------------
Reporter: sivel | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: Plugins | Version:
Severity: normal | Resolution: wontfix
Keywords: has-patch early needs-testing dev- |
feedback |
-------------------------------------------------+-------------------------
Comment (by joehoyle):
Replying to [comment:8 nacin]:
Yeah, totally agree they have certain applications, though I personally
think they are slightly more useful that you say above. IMO the best time
to use them is something like:
{{{
add_action( 'init', function() {
register_post_type( ... );
} );
}}}
So many plugins do the above with `add_action( 'init', 'my_plugin_init'
);` that doesn't make sense to be a function. It's not reusable, it's not
meant to be added / remove by third parties, so probably shouldn't be
added as a top level function. Without closures you end up loads of once-
use weirdly named internal functions for callbacks, making it much more
difficult to have the codebase coherent.
For distributed code, totally get the `remove_action` problem, but 95% of
the code I write is for internal implementations.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14280#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list