Passing Additional Parameters to add_filter Callable
The second parameter in add_filter is a function with accepted arguments, not returned values. This is an example how I pass my custom array $args to change an existing array $filter_args: add_filter( ‘woocommerce_dropdown_variation_attribute_options_args’, function( $filter_args ) use ( $args ) { return eswc_var_dropdown_args( $filter_args, $args ); } ); function eswc_var_dropdown_args( $filter_args, $args ) { $filter_args[‘show_option_none’] … Read more