[wp-trac] Re: [WordPress Trac] #901: apply_filters's handling of extra arguments is broken

WordPress Trac wp-trac at lists.automattic.com
Sun Apr 16 02:32:18 GMT 2006


#901: apply_filters's handling of extra arguments is broken
----------------------------+-----------------------------------------------
       Id:  901             |      Status:  reopened                
Component:  Administration  |    Modified:  Sun Apr 16 02:32:18 2006
 Severity:  normal          |   Milestone:                          
 Priority:  normal          |     Version:  1.5                     
    Owner:  ryan            |    Reporter:  michel v                
----------------------------+-----------------------------------------------
Changes (by angsuman):

  * resolution:  fixed =>
  * severity:  major => normal
  * priority:  high => normal
  * status:  closed => reopened

Comment:

 While using this functionality I realized something strange. To get an
 extra argument (say for 'bloginfo' filter) I have to specify not 2 but
 actually 4 in add_filter. The returned data are:
 first argument, filter name, first argument, second argument

 BTW: One place where this function is needed is for writing 'bloginfo'
 filter. It passes two arguments - value and key.

 So when I add_filter I have to write:
 add_filter('bloginfo', 'my_filter',10, 4 );

 And then I access the second argument as:
 function remove_css($first_argument,$dummy,$dummy,$second_argument)

 I haven't tried for more than 2 arguments but I suspect it will be equally
 funky.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/901>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list