Automattic\WooCommerce\Internal\Features
FeaturesController::change_feature_enable
Change the enabled/disabled status of a feature.
Метод класса: FeaturesController{}
Хуков нет.
Возвращает
true|false. True on success, false if feature doesn't exist or the new value is the same as the old value.
Использование
$FeaturesController = new FeaturesController(); $FeaturesController->change_feature_enable( $feature_id, $enable ): bool;
- $feature_id(строка) (обязательный)
- Unique feature id.
- $enable(true|false) (обязательный)
- True to enable the feature, false to disable it.
Код FeaturesController::change_feature_enable() FeaturesController::change feature enable WC 10.9.4
public function change_feature_enable( string $feature_id, bool $enable ): bool {
if ( ! $this->feature_exists( $feature_id ) ) {
return false;
}
return update_option( $this->feature_enable_option_name( $feature_id ), $enable ? 'yes' : 'no', 'on' );
}