WPSEO_Option::prevent_disabled_options_update
Sets updated values for variables that are disabled via the override option back to their previous values.
Метод класса: WPSEO_Option{}
Хуков нет.
Возвращает
Массив. Updated option value, with all disabled variables set to their old values.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->prevent_disabled_options_update( $updated, $old );
- $updated(массив) (обязательный)
- Updated option value.
- $old(массив) (обязательный)
- Old option value.
Код WPSEO_Option::prevent_disabled_options_update() WPSEO Option::prevent disabled options update Yoast 26.9
protected function prevent_disabled_options_update( $updated, $old ) {
$override_option = $this->get_override_option();
if ( empty( $override_option ) ) {
return $updated;
}
/*
* This loop could as well call `is_disabled( $key )` for each iteration,
* however this would be worse performance-wise.
*/
foreach ( $old as $key => $value ) {
if ( isset( $override_option[ self::ALLOW_KEY_PREFIX . $key ] ) && ! $override_option[ self::ALLOW_KEY_PREFIX . $key ] ) {
$updated[ $key ] = $old[ $key ];
}
}
return $updated;
}