[wp-hackers] Changing two variables listed in apply_filters hook

Robin Adrianse robin.adr at gmail.com
Sun Jul 22 07:37:21 GMT 2007


function test_function( $var1, $var2 ) { }
add_filter( 'filter_name', 'test_function', 10, 2);

The last argument in add_filter is the magic -- it's how many arguments your
function is set up to receive. The 10 is just the default for priority.

On 7/22/07, Ted Balaban <tsbalaban at yahoo.com> wrote:
>
> When the apply_filters hook has 2 variables how
> do you change the second variable in a plugin?
>
> For example:
> apply_filter ('get_categories', $categories, $r);
>
> I know what to do for one variable.  Create a function
> with the specified variable as an argument and in the
> return statement.  Call add_filter.
>
> For example:
> function test_function ($test)  {
>   $test =  .......
>   return $test;
> }
> add_filter ('hook', 'test_function');
>
> Any help is appreciated.
>
> tsbalaban
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list