[wp-hackers] Basic filter question

scribu scribu at gmail.com
Mon Sep 15 19:58:53 GMT 2008


I just wanted to know what filter it was. Thanks for both solutions.

On Mon, Sep 15, 2008 at 10:24 PM, Austin Matzko <if.website at gmail.com>wrote:

> On Mon, Sep 15, 2008 at 1: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');
>
> That won't work, but you could do
> add_filter('the_content', create_function('$content', 'return
> my_function($content, "extra_argument_value1");'),  10);
>
> However, there might be some performance issues with that.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
http://scribu.net


More information about the wp-hackers mailing list