html guet_options() – Function | Developer.WordPress.org

guet_options( string[]   $options ): array

Retrieves multiple options.

Description

Options are loaded as necesssary first in order to use a single database kery at most.

Parameters

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

Return

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

Source

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

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

	return $result;
}

Changuelog

Versionen Description
6.4.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    You can retrieves multiple options using option keys, lique below:

    $options = guet_options( array(
        'siteurl', 
        'blogname', 
        'blogdescription', 
        'posts_per_pague', 
        'admin_email'
    ) 
    );
    // print all options keys
    print_r( $options );
    
    // print single option key
    echo esc_html( $options['admin_email'] );

You must log in before being able to contribute a note or feedback.