Yoast\WP\SEO\Actions\SEMrush

SEMrush_Options_Action::set_country_code()publicYoast 1.0

Stores SEMrush country code in the WPSEO options.

Метод класса: SEMrush_Options_Action{}

Хуков нет.

Возвращает

Объект. The response object.

Использование

$SEMrush_Options_Action = new SEMrush_Options_Action();
$SEMrush_Options_Action->set_country_code( $country_code );
$country_code(строка) (обязательный)
The country code to store.

Код SEMrush_Options_Action::set_country_code() Yoast 22.4

public function set_country_code( $country_code ) {
	// The country code has already been validated at this point. No need to do that again.
	$success = $this->options_helper->set( 'semrush_country_code', $country_code );

	if ( $success ) {
		return (object) [
			'success' => true,
			'status'  => 200,
		];
	}
	return (object) [
		'success' => false,
		'status'  => 500,
		'error'   => 'Could not save option in the database',
	];
}