[wp-hackers] filters with multiple parameters?

Stephen Rider wp-hackers at striderweb.com
Mon Nov 19 15:20:21 GMT 2007


I've been beating my head against this, and would appreciate an assist:

I'm trying to use add_filter, but the hook in question has multiple  
parameters passed and I can't figure out how to access the second  
parameter.  Example code:

add_filter( 'bloginfo', 'my_bloginfo_filter' );

function my_bloginfo_filter ( $output = '', $show = '' ) {
	switch( $show ) {
		case 'version' :
			if ( function_exists( 'mb_get_bloginfo' ) ) {
				$output .= 'Hello World';
			}
			break;
	}
	return $output;
}

This doesn't work because in my function, $show is always empty,  
though $output comes through just fine.  I've tried it as an array --  
no luck: it just splits the $output string into a letter-by-letter  
array.

The hook itself (in core) looks like this:

$output = apply_filters('bloginfo', $output, $show);

How do I get $show in my filter function?

TIA
Stephen



More information about the wp-hackers mailing list