default_option_{$option} WordPress Filter Hook

The default_option_{$option} hook is triggered when the value for a given option is retrieved from the database. This hook allows you to modify the value of an option before it is returned to the caller. This can be useful for cases where you need to massage the data before it is used, or for providing a default value if the option is not set. Note that this hook is called for all options, not just those set by your plugin or theme.

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

Filters the default value for an option.


Description

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


Top ↑

Parameters

$default

(mixed)The default value to return if the option does not exist in the database.

$option

(string)Option name.

$passed_default

(bool)Was get_option() passed a default value?


Top ↑

Source

File: wp-includes/option.php

View on Trac



Top ↑

Changelog

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

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More