wp_default_autoload_value
Allows to determine the default autoload value for an option where no explicit value is passed.
Использование
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(строка)
- The passed option name.
- $value(разное)
- The passed option value to be saved.
- $serialized_value
- -
Список изменений
С версии 6.6.0 | Введена. |
Где вызывается хук
wp_default_autoload_value
wp-includes/option.php 1324
$autoload = apply_filters( 'wp_default_autoload_value', null, $option, $value, $serialized_value );
Где используется хук в WordPress
wp-includes/default-filters.php 292
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.