W3cubDocs

/WordPress

get_options( string[] $options ): array

Retrieves multiple options.

Description

Options are loaded as necessary first in order to use a single database query at most.

Parameters

$optionsstring[]required
An array of option names to retrieve.

Return

array An array of key-value pairs for the requested options.

Source

function get_options( $options ) {
	wp_prime_option_caches( $options );

	$result = array();
	foreach ( $options as $option ) {
		$result[ $option ] = get_option( $option );
	}

	return $result;
}

Changelog

Version Description
6.4.0 Introduced.

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