apply_filters( 'pre_option', mixed $pre_option, string $option, mixed $default_value )
- Since
- 6.1.0
Filters the value of any existing 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.1.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_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_option().
Default false (to skip past the short-circuit). $optionstring- Name of the option.
$default_valuemixed- The fallback value to return if the option does not exist.
Default false.
Where this hook fires · 1
wp-includes/option.php:150get_option()
Source code
<?php * the option doesn't exist elsewhere in get_option(). * Default false (to skip past the short-circuit). * @param string $option Name of the option. * @param mixed $default_value The fallback value to return if the option does not exist. * Default false. */ $pre = apply_filters( 'pre_option', $pre, $option, $default_value ); if ( false !== $pre ) { return $pre; } if ( defined( 'WP_SETUP_CONFIG' ) ) {Changelog
Introduced in 6.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 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.