Title: add_site_option
Published: April 25, 2014
Last modified: May 20, 2026

---

# add_site_option( string $option, mixed $value ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#return)
 * [More Information](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#wp--skip-link--target)

Adds a new option for the current network.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#description)󠁿

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

### 󠀁[See also](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#see-also)󠁿

 * [add_network_option()](https://developer.wordpress.org/reference/functions/add_network_option/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#parameters)󠁿

 `$option`stringrequired

Name of the option to add. Expected to not be SQL-escaped.

`$value`mixedrequired

Option value, can be anything. Expected to not be SQL-escaped.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#return)󠁿

 bool True if the option was added, false otherwise.

## 󠀁[More Information](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#more-information)󠁿

This function essentially the same as [add_option()](https://developer.wordpress.org/reference/functions/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()](https://developer.wordpress.org/reference/functions/add_option/)
on a single site, the feature cannot be overridden.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#source)󠁿

    ```php
    function add_site_option( $option, $value ) {
    	return add_network_option( null, $option, $value );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/option.php#L1950)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/option.php#L1950-L1952)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#related)󠁿

| Uses | Description | 
| [add_network_option()](https://developer.wordpress.org/reference/functions/add_network_option/)`wp-includes/option.php` |

Adds a new network option.

  |

| Used by | Description | 
| [set_site_transient()](https://developer.wordpress.org/reference/functions/set_site_transient/)`wp-includes/option.php` |

Sets/updates the value of a site transient.

  | 
| [wpmu_validate_user_signup()](https://developer.wordpress.org/reference/functions/wpmu_validate_user_signup/)`wp-includes/ms-functions.php` |

Sanitizes and validates data required for a user sign-up.

  | 
| [wpmu_validate_blog_signup()](https://developer.wordpress.org/reference/functions/wpmu_validate_blog_signup/)`wp-includes/ms-functions.php` |

Processes new site registrations.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Modified into wrapper for [add_network_option()](https://developer.wordpress.org/reference/functions/add_network_option/)  | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 4 content](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#comment-content-3894)
 2.    [MakeWebBetter](https://profiles.wordpress.org/makewebbetter/)  [  6 years ago  ](https://developer.wordpress.org/reference/functions/add_site_option/#comment-3894)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_site_option%2F%23comment-3894)
     Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_site_option%2F%23comment-3894)
 4.  **Install the option defaults**
 5.      ```php
          	if ( 1 == $wpmu ) {
                  if ( ! get_site_option( 'wporg_lead_options' ) ) {
                      add_site_option( 'wporg_lead_options', $wporg_lead_options_defaults, '', 'yes' );
                  }
         	} else {
                  if ( ! get_option( 'wporg_lead_options' ) ) {
                      add_option( 'wporg_lead_options', $wporg_lead_options_defaults, '', 'yes' );
                  }
         	}
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_site_option%2F%3Freplytocom%3D3894%23feedback-editor-3894)
 7.   [Skip to note 5 content](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#comment-content-1327)
 8.    [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/add_site_option/#comment-1327)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_site_option%2F%23comment-1327)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_site_option%2F%23comment-1327)
 10. **Examples**
 11. Default usage:
 12.     ```php
         add_site_option( 'my_option', 'my_value' );
         ```
     
 13. Behavior if the option already exists:
 14.     ```php
         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', 'textdomain' );
         }
         ```
     
 15.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_site_option%2F%3Freplytocom%3D1327%23feedback-editor-1327)
 16.  [Skip to note 6 content](https://developer.wordpress.org/reference/functions/add_site_option/?output_format=md#comment-content-250)
 17.   [PaulC53](https://profiles.wordpress.org/paulc53/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/add_site_option/#comment-250)
 18. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_site_option%2F%23comment-250)
     Vote results for this note: -1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_site_option%2F%23comment-250)
 19. Parameter $value is listed as optional. It is not optional; it is required.
 20.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_site_option%2F%3Freplytocom%3D250%23feedback-editor-250)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_site_option%2F)
before being able to contribute a note or feedback.