get_options()
Retrieves multiple options.
Options are loaded as necessary first in order to use a single database query at most.
No Hooks.
Returns
Array. An array of key-value pairs for the requested options.
Usage
get_options( $options );
- $options(string[]) (required)
- An array of option names to retrieve.
Changelog
| Since 6.4.0 | Introduced. |
get_options() get options code WP 6.9.1
function get_options( $options ) {
wp_prime_option_caches( $options );
$result = array();
foreach ( $options as $option ) {
$result[ $option ] = get_option( $option );
}
return $result;
}