apply_filters( 'pre_site_option', mixed $pre_option, string $option, int $network_id, mixed $default_value )
- Since
- 6.9.0
Filters the value of any existing network option before it is retrieved.
Description
Returning a value other than false from the filter will short-circuit retrieval and return that value instead.
Compatibility
- WordPress
- since 6.9.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in 3 of the 5 tracked releases, added in 6.9.0.
Parameters
$pre_optionmixed- The value to return instead of the network option value. This differs from
$default_value, which is used as the fallback value in the event the option doesn't exist elsewhere in get_network_option().
Default false (to skip past the short-circuit). $optionstring- Name of the option.
$network_idint- ID of the network.
$default_valuemixed- The fallback value to return if the option does not exist.
Default false.
Where this hook fires · 1
wp-includes/option.php:2057get_network_option()
Source code
* Default false (to skip past the short-circuit). * @param string $option Name of the option. * @param int $network_id ID of the network. * @param mixed $default_value The fallback value to return if the option does not exist. * Default false. */ $pre = apply_filters( 'pre_site_option', $pre, $option, $network_id, $default_value ); if ( false !== $pre ) { return $pre; } // Prevent non-existent options from triggering multiple queries.Changelog
Introduced in 6.9.0. Unchanged from 6.9.7 through 7.1.0.
Signature, return type and hooks compared across 3 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.