Yoast\WP\SEO\AI\Content_Planner\User_Interface

Get_Outline_Route::register_routespublicYoast 1.0

Registers routes with WordPress.

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

Хуков нет.

Возвращает

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

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

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

Код Get_Outline_Route::register_routes() Yoast 28.3

public function register_routes() {
	\register_rest_route(
		self::ROUTE_NAMESPACE,
		self::ROUTE_PREFIX,
		[
			'methods'             => 'POST',
			'args'                => [
				'post_type'        => [
					'required'    => true,
					'type'        => 'string',
					'description' => 'The post type to get a content outline for.',
				],
				'language'         => [
					'required'    => true,
					'type'        => 'string',
					'description' => 'The language the content is written in.',
				],
				'editor'           => [
					'required'    => true,
					'type'        => 'string',
					'enum'        => [
						'classic',
						'elementor',
						'gutenberg',
					],
					'description' => 'The current editor.',
				],
				'title'            => [
					'required'    => true,
					'type'        => 'string',
					'description' => 'The title of the chosen content suggestion.',
				],
				'intent'           => [
					'required'    => true,
					'type'        => 'string',
					'description' => 'The intent of the chosen content suggestion.',
				],
				'explanation'      => [
					'required'    => true,
					'type'        => 'string',
					'description' => 'The explanation of the chosen content suggestion.',
				],
				'keyphrase'        => [
					'required'    => true,
					'type'        => 'string',
					'description' => 'The keyphrase of the chosen content suggestion.',
				],
				'meta_description' => [
					'required'    => true,
					'type'        => 'string',
					'description' => 'The meta description of the chosen content suggestion.',
				],
				'category'         => [
					'required'    => true,
					'type'        => 'object',
					'properties'  => [
						'name' => [
							'type'     => 'string',
							'required' => true,
						],
						'id'   => [
							'type'     => 'integer',
							'required' => true,
						],
					],
					'description' => 'The category of the chosen content suggestion. Use name "" and id -1 to indicate no category.',
				],
				'recent_content'   => [
					'required'    => true,
					'type'        => 'array',
					'maxItems'    => 100,
					'items'       => [
						'type'                 => 'object',
						'properties'           => [
							'title'       => [
								'type'      => 'string',
								'required'  => true,
								'maxLength' => 500,
							],
							'description' => [
								'type'      => 'string',
								'required'  => true,
								'maxLength' => 1000,
							],
						],
						'additionalProperties' => false,
					],
					'description' => 'The recent content returned by the get_suggestions response.',
				],
			],
			'callback'            => [ $this, 'get_outline' ],
			'permission_callback' => [ $this, 'check_permissions' ],
		],
	);
}