Function: add_site_option

add_site_option( string $option, mixed $value )

Add a new option for the current network.

Shortcut: aso

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

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

Parameters

Name Type(s) Default Value Description
$option string

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

$value mixed

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

Returns

boolean

False if the option was not added. True if the option was added.

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.