WPSEO_Options::save_option
Saves the option to the database.
Метод класса: WPSEO_Options{}
Хуков нет.
Возвращает
true|false. Returns true if the option is successfully saved in the database.
Использование
$result = WPSEO_Options::save_option( $wpseo_options_group_name, $option_name, $option_value );
- $wpseo_options_group_name(строка) (обязательный)
- The name for the wpseo option group in the database.
- $option_name(строка) (обязательный)
- The name for the option to set.
- $option_value(разное) (обязательный)
- The value for the option.
Код WPSEO_Options::save_option() WPSEO Options::save option Yoast 27.3
public static function save_option( $wpseo_options_group_name, $option_name, $option_value ) {
$options = static::get_option( $wpseo_options_group_name );
$options[ $option_name ] = $option_value;
if ( isset( static::$option_instances[ $wpseo_options_group_name ] ) && static::$option_instances[ $wpseo_options_group_name ]->multisite_only === true ) {
static::update_site_option( $wpseo_options_group_name, $options );
}
else {
update_option( $wpseo_options_group_name, $options );
}
// Check if everything got saved properly.
$saved_option = static::get_option( $wpseo_options_group_name );
// Clear our cache.
static::clear_cache();
return $saved_option[ $option_name ] === $options[ $option_name ];
}