wp_set_option_autoload()
Sets the autoload value for an option in the database.
This is a wrapper for wp_set_option_autoload_values(), which can be used to set the autoload value for multiple options at once.
No Hooks.
Returns
true|false. True if the autoload value was modified, false otherwise.
Usage
wp_set_option_autoload( $option, $autoload );
- $option(string) (required)
- Name of the option. Expected to not be SQL-escaped.
- $autoload(true|false) (required)
- Autoload value to control whether to load the option when WordPress starts up. For backward compatibility
'yes'and'no'are also accepted, though using these values is deprecated.
Notes
Changelog
| Since 6.4.0 | Introduced. |
| Since 6.7.0 | The autoload values 'yes' and 'no' are deprecated. |
wp_set_option_autoload() wp set option autoload code WP 7.0
function wp_set_option_autoload( $option, $autoload ) {
$result = wp_set_option_autoload_values( array( $option => $autoload ) );
return $result[ $option ] ?? false;
}