Options: Pass `$default` as a new parameter to the `pre_option_{$option}` and `pre_site_option_{$option}` filters.
This change standardizes some language in the parameter descriptions between the two hook docs in an effort to reduce confusion between the `$pre_option` pseudo-parameters and the new `$default` ones. `$pre_option` is the truthy value used to short-circuit the `get_*option()` call, `$default` is the value passed to the `get_*option()` returned in the event that 1) a short circuit isn't performed, 2) the option doesn't exist. Props sc0ttkclark. Fixes #41254. Built from https://develop.svn.wordpress.org/trunk@41013 git-svn-id: http://core.svn.wordpress.org/trunk@40863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6b907d8437
commit
fdaf531325
|
@ -44,12 +44,19 @@ function get_option( $option, $default = false ) {
|
|||
*
|
||||
* @since 1.5.0
|
||||
* @since 4.4.0 The `$option` parameter was added.
|
||||
* @since 4.9.0 The `$default` parameter was added.
|
||||
*
|
||||
* @param bool|mixed $pre_option Value to return instead of the option value.
|
||||
* Default false to skip it.
|
||||
*
|
||||
* @param bool|mixed $pre_option The value to return instead of the option value. This differs from
|
||||
* `$default`, 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).
|
||||
* @param string $option Option name.
|
||||
* @param mixed $default The fallback value to return if the option does not exist.
|
||||
* Default is false.
|
||||
*/
|
||||
$pre = apply_filters( "pre_option_{$option}", false, $option );
|
||||
$pre = apply_filters( "pre_option_{$option}", false, $option, $default );
|
||||
|
||||
if ( false !== $pre )
|
||||
return $pre;
|
||||
|
||||
|
@ -1116,12 +1123,18 @@ function get_network_option( $network_id, $option, $default = false ) {
|
|||
* @since 3.0.0
|
||||
* @since 4.4.0 The `$option` parameter was added.
|
||||
* @since 4.7.0 The `$network_id` parameter was added.
|
||||
* @since 4.9.0 The `$default` parameter was added.
|
||||
*
|
||||
* @param mixed $pre_option The default value to return if the option does not exist.
|
||||
* @param mixed $pre_option The value to return instead of the option value. This differs from
|
||||
* `$default`, which is used as the fallback value in the event the
|
||||
* option doesn't exist elsewhere in get_network_option(). Default
|
||||
* is false (to skip past the short-circuit).
|
||||
* @param string $option Option name.
|
||||
* @param int $network_id ID of the network.
|
||||
* @param mixed $default The fallback value to return if the option does not exist.
|
||||
* Default is false.
|
||||
*/
|
||||
$pre = apply_filters( "pre_site_option_{$option}", false, $option, $network_id );
|
||||
$pre = apply_filters( "pre_site_option_{$option}", false, $option, $network_id, $default );
|
||||
|
||||
if ( false !== $pre ) {
|
||||
return $pre;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9-alpha-41012';
|
||||
$wp_version = '4.9-alpha-41013';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue