WPSEO_Options::get()public staticYoast 1.0

Retrieve a single field from any option for the SEO plugin. Keys are always unique.

Метод класса: WPSEO_Options{}

Хуков нет.

Возвращает

Разное. Returns value if found, $default_value if not.

Использование

$result = WPSEO_Options::get( $key, $default_value, $option_groups );
$key(строка) (обязательный)
The key it should return.
$default_value(разное)
The default value that should be returned if the key isn't set.
По умолчанию: null
$option_groups(array)
The option groups to retrieve the option from.
По умолчанию: []

Код WPSEO_Options::get() Yoast 24.9

public static function get( $key, $default_value = null, $option_groups = [] ) {
	if ( ! isset( static::$option_values[ $key ] ) ) {
		static::prime_cache( $option_groups );
	}
	if ( isset( static::$option_values[ $key ] ) ) {
		return static::$option_values[ $key ];
	}

	return $default_value;
}