Yoast\WP\SEO\Abilities\User_Interface

AI_Generate_Upsell::add_hint │ public │ Yoast 1.0

Adds the AI Generate hint to the result when a field AI Generate can write was set on the free plugin.

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

Хуков нет.

Возвращает

array<string, int|string|bool|null>|WP_Error. The result, with the hint when applicable.

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

$AI_Generate_Upsell = new AI_Generate_Upsell();
$AI_Generate_Upsell->add_hint( $result, $input );
$result(array<string, int|строка|true|false|null>|WP_Error) (обязательный)
The result of the write.
$input(array<string, int|строка|true|false|null>) (обязательный)
The ability input.

Код AI_Generate_Upsell::add_hint() Yoast 28.9

public function add_hint( $result, array $input ) {
	// Errors, and anything else that is not a data array, are passed through untouched for the Abilities API to handle.
	if ( ! \is_array( $result ) || ! $this->should_upsell( $input ) ) {
		return $result;
	}

	$result['ai_generate_hint'] = \sprintf(
		/* translators: %1$s expands to "Yoast AI Generate", %2$s expands to a URL. */
		\__( '%1$s can write SEO-optimised titles and descriptions, more details here: %2$s', 'wordpress-seo' ),
		self::AI_GENERATE_NAME,
		self::AI_GENERATE_RESPONSE_SHORTLINK,
	);

	return $result;
}