Essentially the same as add_option() but works network wide when using WP Multisite.
The only major difference is that on multisite site-wide options will not autoload and on a single site the option will autoload. Unlike when using add_option() on a single site, the feature cannot be overridden.
<?php add_site_option( $option, $value ); ?>
Default usage:
add_site_option( 'my_option', 'my_value' );
Behavior if the option already exists:
echo get_site_option( 'i_exist_already' ); // Output: 'some_value' if ( add_site_option( 'i_exist_already', 'new_value' ) ) { echo get_site_option( 'i_exist_already' ); } else { echo 'Already exists'; } // Output before WP 3.3: 'new_value' // Output after WP 3.3: 'Already exists'
add_site_option()
is located in wp-includes/option.php
.