On this page
add_site_option( string $option, mixed $value ): bool
Adds a new option for the current network.
Description
Existing options will not be updated. Note that prior to 3.3 this wasn’t the case.
See also
Parameters
$optionstring Required-
Name of the option to add. Expected to not be SQL-escaped.
$valuemixed Required-
Option value, can be anything. Expected to not be SQL-escaped.
Return
bool True if the option was added, false otherwise.
More Information
This function 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.
Source
File: wp-includes/option.php. View all references
function add_site_option( $option, $value ) {
return add_network_option( null, $option, $value );
}
Related
Uses
| Uses | Description |
|---|---|
| add_network_option() wp-includes/option.php | Adds a new network option. |
Used By
| Used By | Description |
|---|---|
| set_site_transient() wp-includes/option.php | Sets/updates the value of a site transient. |
| wpmu_validate_user_signup() wp-includes/ms-functions.php | Sanitizes and validates data required for a user sign-up. |
| wpmu_validate_blog_signup() wp-includes/ms-functions.php | Processes new site registrations. |
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Modified into wrapper for add_network_option() |
| 2.8.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/add_site_option