wp_default_autoload_value
Allows to determine the default autoload value for an option where no explicit value is passed.
Usage
add_filter( 'wp_default_autoload_value', 'wp_kama_default_autoload_value_filter', 10, 4 ); /** * Function for `wp_default_autoload_value` filter-hook. * * @param bool|null $autoload The default autoload value to set. Returning true will be set as 'auto-on' in the database, false will be set as 'auto-off', and null will be set as 'auto'. * @param string $option The passed option name. * @param mixed $value The passed option value to be saved. * @param $serialized_value * * @return bool|null */ function wp_kama_default_autoload_value_filter( $autoload, $option, $value, $serialized_value ){ // filter... return $autoload; }
- $autoload(true|false|null)
- The default autoload value to set. Returning true will be set as 'auto-on' in the database, false will be set as 'auto-off', and null will be set as 'auto'.
- $option(string)
- The passed option name.
- $value(mixed)
- The passed option value to be saved.
- $serialized_value
- -
Changelog
Since 6.6.0 | Introduced. |
Where the hook is called
wp_default_autoload_value
wp-includes/option.php 1333
$autoload = apply_filters( 'wp_default_autoload_value', null, $option, $value, $serialized_value );
Where the hook is used in WordPress
wp-includes/default-filters.php 298
add_filter( 'wp_default_autoload_value', 'wp_filter_default_autoload_value_via_option_size', 5, 4 ); // Allow the value to be overridden at the default priority.