wp_set_options_autoload()WP 6.4.0

Enables or disables autoloading for several options without changing their values.

No Hooks.

Returns

Array.

  • array - option => result pairs. true means autoloading was updated; false means the option was not found, already had the requested value, or the request failed.

Usage

wp_set_options_autoload( $options, $autoload );
$options(string[]) (required)
Option names without SQL escaping.
$autoload(bool) (required)
true enables autoloading and false disables it. The 'yes' and 'no' values are deprecated.

Examples

0

#1 Disabling option autoloading

$result = wp_set_options_autoload(
	[
		'my_plugin_settings',
		'my_plugin_statistics',
	],
	false
);

Notes

Changelog

Since 6.4.0 Introduced.
Since 6.7.0 The autoload values 'yes' and 'no' are deprecated.

wp_set_options_autoload() code WP 7.0.4

function wp_set_options_autoload( array $options, $autoload ) {
	return wp_set_option_autoload_values(
		array_fill_keys( $options, $autoload )
	);
}