wp_default_autoload_value
Filter HookDescription
Allows to determine the default autoload value for an option where no explicit value is passed.Hook Information
File Location |
wp-includes/option.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1333 |
Hook Parameters
Type | Name | Description |
---|---|---|
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'. |
string
|
$option
|
The passed option name. |
mixed
|
$value
|
The passed option value to be saved. |
Usage Examples
Basic Usage
<?php
// Hook into wp_default_autoload_value
add_filter('wp_default_autoload_value', 'my_custom_filter', 10, 3);
function my_custom_filter($autoload, $option, $value) {
// Your custom filtering logic here
return $autoload;
}
Source Code Context
wp-includes/option.php:1333
- How this hook is used in WordPress core
<?php
1328 * @param bool|null $autoload The default autoload value to set. Returning true will be set as 'auto-on' in the
1329 * database, false will be set as 'auto-off', and null will be set as 'auto'.
1330 * @param string $option The passed option name.
1331 * @param mixed $value The passed option value to be saved.
1332 */
1333 $autoload = apply_filters( 'wp_default_autoload_value', null, $option, $value, $serialized_value );
1334 if ( is_bool( $autoload ) ) {
1335 return $autoload ? 'auto-on' : 'auto-off';
1336 }
1337
1338 return 'auto';
PHP Documentation
<?php
/**
* Allows to determine the default autoload value for an option where no explicit value is passed.
*
* @since 6.6.0
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/option.php
Related Hooks
Related hooks will be displayed here in future updates.