[wp-trac] [WordPress Trac] #11212: Add filter to wp_parse_args()

WordPress Trac wp-trac at lists.automattic.com
Sun Nov 22 00:33:29 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 Viper007Bond):

 As I said, the filter inside `wp_parse_args()` would only be run if a
 context was passed.

 As for the second, take `wp_list_comments()` for example. Where would you
 put the filter? You'd add one that filtered `$args` or `$r`, or for
 simplicity, you'd just wrap the `wp_parse_args()` call in a filter:

 {{{
 $r = apply_filters( 'some_filter', wp_parse_args( $args, $defaults ),
 $args, $defaults );
 }}}


 Well what's the point of that when you could just have `wp_parse_args()`
 do the filter? Saves a lot of duplicated code.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11212#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list