[wp-trac] [WordPress Trac] #11212: Add filter to wp_parse_args()
WordPress Trac
wp-trac at lists.automattic.com
Sun Nov 22 01:04:43 UTC 2009
#11212: Add filter to wp_parse_args()
--------------------------+-------------------------------------------------
Reporter: Viper007Bond | Owner:
Type: enhancement | Status: new
Priority: lowest | Milestone: Future Release
Component: General | Version: 2.9
Severity: normal | Keywords: has-patch
--------------------------+-------------------------------------------------
Comment(by filosofo):
Replying to [comment:7 Viper007Bond]:
> Well what's the point of that when you could just have `wp_parse_args()`
do the filter? Saves a lot of duplicated code.
Because otherwise you're going to influence performance geometrically.
Let's say I want to change the max_depth argument. With a
wp_list_comments-specific filter, my attached callback gets called once.
With the wp_parse_args filter, it's called 80-some times.
Then let's say I want to do something similar elsewhere, e.g. in
register_taxonomy(). With a register_taxonomy-specific filter, that
callback fires once; with wp_parse_args, it's 80 times.
So with just 2 callbacks, we've turned what could be 2 function calls into
160.
And that's not even considering the issues making everything compatible
with other plugins.
Note that I'm not necessarily arguing against this filter: I'm saying it
should be a last resort choice when nothing else is available, like the
"query" filter in wp-db. If we need more targeted filters, let's put
those in first.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11212#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list