Code-Snippets-Functions/Execute a function on a child site/WooCommerce/set-woocommerce-tracking-option-as-no-by-default.txt

15 lines
426 B
Text

$option_name = 'woocommerce_allow_tracking' ;
$new_value = 'no' ;
if ( get_option( $option_name ) !== false ) {
// The option already exists, so we just update it.
update_option( $option_name, $new_value );
} else {
// The option hasn't been added yet. We'll add it with $autoload set to 'no'.
$deprecated = null;
$autoload = 'no';
add_option( $option_name, $new_value, $deprecated, $autoload );
}