diff --git a/src/wp-includes/option.php b/src/wp-includes/option.php index 9f7cc8698e..7715426608 100644 --- a/src/wp-includes/option.php +++ b/src/wp-includes/option.php @@ -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;