Yoast\WP\SEO\Actions
Integrations_Action::set_integration_active()
Sets an integration state.
Метод класса: Integrations_Action{}
Хуков нет.
Возвращает
Объект
. The response object.
Использование
$Integrations_Action = new Integrations_Action(); $Integrations_Action->set_integration_active( $integration_name, $value );
- $integration_name(строка) (обязательный)
- The name of the integration to activate/deactivate.
- $value(true|false) (обязательный)
- The value to store.
Код Integrations_Action::set_integration_active() Integrations Action::set integration active Yoast 24.0
public function set_integration_active( $integration_name, $value ) { $option_name = $integration_name . '_integration_active'; $success = true; $option_value = $this->options_helper->get( $option_name ); if ( $option_value !== $value ) { $success = $this->options_helper->set( $option_name, $value ); } if ( $success ) { return (object) [ 'success' => true, 'status' => 200, ]; } return (object) [ 'success' => false, 'status' => 500, 'error' => 'Could not save the option in the database', ]; }