[wp-trac] [WordPress Trac] #23259: Allow filtering the $function parameter of add_filter(), has_filter() and remove_filter()
WordPress Trac
noreply at wordpress.org
Tue Jan 22 04:23:30 UTC 2013
#23259: Allow filtering the $function parameter of add_filter(), has_filter() and
remove_filter()
------------------------------------+-----------------------------
Reporter: MikeSchinkel | Type: feature request
Status: new | Priority: normal
Milestone: Awaiting Review | Component: Plugins
Version: 3.5 | Severity: normal
Keywords: has-patch dev-feedback |
------------------------------------+-----------------------------
In a [http://hardcorewp.com/2012/enabling-action-and-filter-hook-removal-
from-class-based-wordpress-plugins/#comment-494 comment] made by someone
on a recent blog post of mine entitled ''"Enabling Action and Filter Hook
Removal from Class-based WordPress Plugins"'' the commenter lamented on
the complexity of removing hooks when plugin developers use classes.
Plugin developers who use classes use so many different architectures;
i.e. some use static methods, others using instance methods with
singletons, other's use class factories, etc. If WordPress were to allow
plugin developers to filter the `$function` value passed to the
`_wp_filter_build_unique_id()` function then our plugins could mask much
of the complexity required for the site builder to interact with our
plugins. I could for example support the following syntax even though I'm
really might be using a Singleton:
{{{
remove_action( 'the_content', 'My_Plugin_Main_Class::the_content' );
}}}
Of even the following so the site builder doesn't have to know all about
my class hierarchy:
{{{
remove_action( 'the_content', 'My_Plugin::the_content' );
}}}
Then it would just be up to the plugin developer to add some simple
documentation to their plugin's README file.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23259>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list