Yoast\WP\SEO\AI_Generator\User_Interface

Get_Suggestions_Route::register_routespublicYoast 1.0

Registers routes with WordPress.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$Get_Suggestions_Route = new Get_Suggestions_Route();
$Get_Suggestions_Route->register_routes();

Код Get_Suggestions_Route::register_routes() Yoast 28.3

public function register_routes() {
	\register_rest_route(
		self::ROUTE_NAMESPACE,
		self::ROUTE_PREFIX,
		[
			'methods'             => 'POST',
			'args'                => [
				'type'            => [
					'required'    => true,
					'type'        => 'string',
					'enum'        => [
						'seo-title',
						'meta-description',
						'product-seo-title',
						'product-meta-description',
						'product-taxonomy-seo-title',
						'product-taxonomy-meta-description',
						'taxonomy-seo-title',
						'taxonomy-meta-description',
					],
					'description' => 'The type of suggestion requested.',
				],
				'prompt_content'  => [
					'required'    => true,
					'type'        => 'string',
					'description' => 'The content needed by the prompt to ask for suggestions.',
				],
				'focus_keyphrase' => [
					'required'    => true,
					'type'        => 'string',
					'description' => 'The focus keyphrase associated to the post.',
				],
				'language'        => [
					'required'    => true,
					'type'        => 'string',
					'description' => 'The language the post is written in.',
				],
				'platform'        => [
					'required'    => true,
					'type'        => 'string',
					'enum'        => [
						'Google',
						'Facebook',
						'Twitter',
					],
					'description' => 'The platform the post is intended for.',
				],
				'editor' => [
					'required'    => true,
					'type'        => 'string',
					'enum'        => [
						'classic',
						'elementor',
						'gutenberg',
					],
					'description' => 'The current editor.',
				],
			],
			'callback'            => [ $this, 'get_suggestions' ],
			'permission_callback' => [ $this, 'check_permissions' ],
		],
	);
}