apply_filters( "pre_site_option_{$option}", mixed $pre_site_option, string $option, int $network_id, mixed $default_value )
- Since
- 2.9.0, 3.0.0, 4.4.0, 4.7.0, 4.9.0
Filters the value of an existing network option before it is retrieved.
Description
The dynamic portion of the hook name, $option, refers to the option name.
Returning a value other than false from the filter will short-circuit retrieval and return that value instead.
Compatibility
- WordPress
- since 4.9.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$pre_site_optionmixed- The value to return instead of the 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- Option name.
$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:2036get_network_option()
Source code
* Default false (to skip past the short-circuit). * @param string $option Option name. * @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_{$option}", false, $option, $network_id, $default_value ); /** * Filters the value of any existing network option before it is retrieved. * * Returning a value other than false from the filter will short-circuit retrieval * and return that value instead.Changelog
Introduced in 4.9.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
4.9.0
The
$default_value parameter was added.from the docblock4.7.0
The
$network_id parameter was added.from the docblock4.4.0
The
$option parameter was added.from the docblock3.0.0
from the docblock
2.9.0
As
pre_site_option_{$key}.from the docblockAbout this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 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.