add_site_option

Add a new option for the current network.

Description

add_site_option( (string) $option, (mixed) $value ); 

Existing options will not be updated. Note that prior to 3.3 this wasn't the case.

Parameters (2)

0. $option (string)
Name of option to add. Expected to not be SQL-escaped.
1. $value (mixed)
Option value, can be anything. Expected to not be SQL-escaped.

Usage

  1. if ( !function_exists( 'add_site_option' ) ) { 
  2. require_once ABSPATH . WPINC . '/option.php'; 
  3.  
  4. // Name of option to add. Expected to not be SQL-escaped. 
  5. $option = ''; 
  6.  
  7. // Option value, can be anything. Expected to not be SQL-escaped. 
  8. $value = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = add_site_option($option, $value); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/option.php  
  1. function add_site_option( $option, $value ) { 
  2. return add_network_option( null, $option, $value );