wppaste
WordPress

apply_filters( "default_option_{$option}", mixed $default_value, string $option, bool $passed_default )

Since
3.4.0, 4.4.0, 4.7.0
Filters the default value for an option.

Description

The dynamic portion of the hook name, $option, refers to the option name.

Compatibility

WordPress
since 4.7.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

$default_valuemixed
The default value to return if the option does not exist in the database.
$optionstring
Option name.
$passed_defaultbool
Was get_option() passed a default value?

Where this hook fires · 5

  • wp-includes/option.php:199get_option()
  • wp-includes/option.php:217get_option()
  • wp-includes/option.php:230get_option()
  • wp-includes/option.php:926update_option()
  • wp-includes/option.php:1121add_option()

Source code

				 *				 * @param mixed  $default_value  The default value to return if the option does not exist				 *                               in the database.				 * @param string $option         Option name.				 * @param bool   $passed_default Was `get_option()` passed a default value?				 */				return apply_filters( "default_option_{$option}", $default_value, $option, $passed_default );			} 			$value = wp_cache_get( $option, 'options' ); 			if ( false === $value ) {

Changelog

Introduced in 3.4.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

4.7.0
The $passed_default parameter was added to distinguish between a false value and the default parameter value.from the docblock
4.4.0
The $option parameter was added.from the docblock
3.4.0
Introduced.from the docblock

About 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.