[wp-hackers] Basic filter question

Otto otto at ottodestruct.com
Mon Sep 15 19:19:15 GMT 2008


Is this simply because you want to know what the current filter is? Or
do you have some other reason?

Because you can just call current_filter() inside your filter to gt
'the_content' or 'the_excerpt' in your two examples.


On Mon, Sep 15, 2008 at 12:44 PM, scribu <scribu at gmail.com> wrote:
> Hello, I was wondering if it was possible to pass an extra argument to a
> function called from a filter, e.g.
>
>
> function my_function($content, $extra_argument) {
>    // Do something to the $content based on $extra_argument
> }
>
> add_filter('the_content', 'my_function', 10, 2, 'extra_argument_value1');
> add_filter('the_excerpt', 'my_function', 10, 2, 'extra_argument_value2');
>
>
> I know I can just have two similar functions, but that's not the idea.
>
> --
> http://scribu.net
> _______________________________________________
> 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