更改add_filters数组中的函数

Deep within the WooCommerce Composite Products plugin, there is the below add_filters array:

        /**
     * Filter front-end params.
     *
     * @param  array  $params
     */
    $params = apply_filters( 'woocommerce_composite_front_end_params', array(
        'small_width_threshold'                 => 450,
        'full_width_threshold'                  => 450,
        'legacy_width_threshold'                => 450,
        'i18n_qty_string'                       => _x( ' × %s', 'qty string', 'woocommerce-composite-products' ),
        'i18n_price_string'                     => _x( ' – %s', 'price suffix', 'woocommerce-composite-products' ),
        'i18n_title_string'                     => sprintf( _x( '%1$s%2$s%3$s', 'title quantity price', 'woocommerce-composite-products' ), '%t', '%q', '%p' ),
        'i18n_selected_product_string'          => sprintf( _x( '%1$s%2$s', 'product title followed by details', 'woocommerce-composite-products' ), '%t', '%m' ),
        'i18n_free'                             => __( 'Free!', 'woocommerce' ),
        'i18n_total'                            => __( 'Total', 'woocommerce-composite-products' ) . ': ',
        'i18n_no_options'                       => __( 'No options available…', 'woocommerce-composite-products' ),
        'i18n_no_selection'                     => __( 'No selection', 'woocommerce-composite-products' ),
        'i18n_no_option'                        => _x( 'No %s', 'dropdown empty-value option: optional selection (%s replaced by component title)','woocommerce-composite-products' ),

etc, etc...

What I'm trying to do is a remove_filter on two of the functions (in this case, i18n_clear_selection and i18n_strikeout_price_string), and change the first variable of i18n_no_option.

I've tried doing remove_filter( 'woocommerce_composite_front_end_params', 'i18n_strikeout_price_string' ); which did nothing, and tried using the below snippet (from this StackOverflow page):

function change_composite_product_functions($arr) {
$arr = array(
        'i18n_stirkeout_price_string'           => __(),
        'i18n_clear_selection'                  => __(),
        'i18n_no_option'                        => _x( 'Blah blah this is a test', 'dropdown empty-value options: optional selection (%s replaced by component title)','woocommerce-composite-products' ),
    );
return $arr;
}
 add_filter( 'woocommerce_composite_front_end_params', 'change_composite_product_functions', 10, 1 );

But that just returned a white page - no errors or anything. Is there a way to isolate functions within an array and remove / change just those?

Note that '$arr' variable will be populated with data that is being passed to the 'change_composite_product_functions' function.

Your section of code is literally overriding it with your new array.

You are looking to locate the array key/item and change/remove it. Quick untested/rough snippet below:

function change_composite_product_functions($arr) {
if (array_key_exists('i18n_stirkeout_price_string', $arr)) unset($arr['i18n_stirkeout_price_string']); // Remove
if (array_key_exists('i18n_no_option', $arr)) $arr['i18n_no_option'] = 'Blah blah this is a test'; // Change
return $arr;
}
add_filter( 'woocommerce_composite_front_end_params', 'change_composite_product_functions', 10, 1 );