WPSEO_Upgrade::save_option_settingprotectedYoast 1.0

Saves an option setting to where it should be stored.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->save_option_setting( $source_data, $source_setting, $target_setting );
$source_data(int|строка|true|false|float|array<string|int|true|false|float>) (обязательный)
The option containing the value to be migrated.
$source_setting(строка) (обязательный)
Name of the key in the "from" option.
$target_setting(строка|null)
Name of the key in the "to" option.
По умолчанию: null

Код WPSEO_Upgrade::save_option_setting() Yoast 27.3

protected function save_option_setting( $source_data, $source_setting, $target_setting = null ) {
	$target_setting ??= $source_setting;

	if ( isset( $source_data[ $source_setting ] ) ) {
		WPSEO_Options::set( $target_setting, $source_data[ $source_setting ] );
	}
}