W3cubDocs

/WordPress

wp_set_options_autoload( string[] $options, bool $autoload ): array

Sets the autoload value for multiple options in the database.

Description

This is a wrapper for wp_set_option_autoload_values(), which can be used to set different autoload values for each option at once.

See also

Parameters

$optionsstring[]required
List of option names. Expected to not be SQL-escaped.
$autoloadboolrequired
Autoload value to control whether to load the options when WordPress starts up.
For backward compatibility 'yes' and 'no' are also accepted, though using these values is deprecated.

Return

array Associative array of all provided $options as keys and boolean values for whether their autoload value was updated.

Source

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

Changelog

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

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_set_options_autoload