alch_network_value_{ $optionID }

Dynamic filter alch_network_value_{ $optionID } is similar to alch_value_{ $optionID }. It is used to filter the value for a given field before returning it from alch_get_network_option. It isn't applied to the $default parameter if the field has no value stored.

The $optionID should match one of the IDs in the configuration object.

Example

Say you want to tweak the URL field with the ID of my-url-field to convert the http protocol to https.

//somewhere in functions.php

function tweak_network_url_field( $value ) {
    // do not forget to pass it further
    return str_replace( "http://", "https://", $value );
}

add_filter( 'alch_network_value_my-url-field', 'tweak_network_url_field' );

Last updated