How To Accept Multiple Parameters in WordPress Filters
By Angsuman Chakraborty, Gaea News NetworkSaturday, April 15, 2006
This is for WordPress Plugin and Theme developers. Don’t read further if you are not one of them.
To get an extra argument in your filter (say for a ‘bloginfo’ filter) you have to specify not 2 but actually 4 as number of arguments in add_filter (read below for details). 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 );
10 is the priority
4 is the argument count
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. I have reopened ticket 901 and update the comments.
mohammad