[wp-hackers] add_filter before or after function?

Matt speedboxer at gmail.com
Thu Aug 30 02:11:24 GMT 2007


Also, can't functions be called no matter where they're defined in a file?

On 8/29/07, Jennifer Hodgdon <yahgrp at poplarware.com> wrote:
>
> Jeremy Visser wrote:
> > DD32 wrote:
> >> add_filter('query_vars', 'test_queryvars' );
> >> function test_queryvars( $qvars ){
> >>     $qvars[] = 'artist_slug';
> >>     $qvars[] = 'artist_page';
> >>     return $qvars;
> >> }
> >
> > I notice you add the add_filter() _before_ you declare the actual
> > function. Others do that too, while other add the add_filter() (or
> > add_action()) _after_ the function.
> >
> > Which is best?
>
> Actually, it doesn't matter. When you call add_filter, you are only
> passing in the name of the function you want to use later for
> filtering. By the time WP calls the function to filter something, the
> function will be defined.
>
>     --Jennifer
>
> --
> Jennifer Hodgdon
>
> Poplar ProductivityWare * www.poplarware.com
> Web Databases/Scripts * Modeling/Analysis/Palm OS Software
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Matt (speedboxer at gmail.com)
http://mattsblog.ca/ | http://livemp.net/


More information about the wp-hackers mailing list