Yoast\WP\SEO\Actions\Importing\Aioseo

Aioseo_Validate_Data_Action::validate_default_robot_settings()publicYoast 1.0

Validates the default AIOSEO robots settings for search appearance settings from the options table.

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

Хуков нет.

Возвращает

true|false. Whether the AIOSEO robots settings for search appearance settings from the options table exist and have the structure we expect.

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

$Aioseo_Validate_Data_Action = new Aioseo_Validate_Data_Action();
$Aioseo_Validate_Data_Action->validate_default_robot_settings();

Код Aioseo_Validate_Data_Action::validate_default_robot_settings() Yoast 22.4

public function validate_default_robot_settings() {

	foreach ( $this->settings_importing_actions as $settings_import_action ) {
		$robot_setting_map = $settings_import_action->pluck_robot_setting_from_mapping();

		// Some actions return empty robot settings, let's not validate against those.
		if ( ! empty( $robot_setting_map ) ) {
			$aioseo_settings = \json_decode( \get_option( $robot_setting_map['option_name'], '' ), true );

			if ( ! isset( $aioseo_settings['searchAppearance'][ $robot_setting_map['type'] ][ $robot_setting_map['subtype'] ]['advanced']['robotsMeta']['default'] ) ) {
				return false;
			}
		}
	}

	return true;
}