WPSEO_Upgrade::save_option_setting()protectedYoast 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(массив) (обязательный)
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 22.1

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

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