Yoast\WP\SEO\Dashboard\User_Interface\Scores

Abstract_Scores_Route::register_routes()publicYoast 1.0

Registers routes for scores.

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

Хуков нет.

Возвращает

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

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

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

Код Abstract_Scores_Route::register_routes() Yoast 24.4

public function register_routes() {
	\register_rest_route(
		self::ROUTE_NAMESPACE,
		$this->get_route_prefix(),
		[
			[
				'methods'             => 'GET',
				'callback'            => [ $this, 'get_scores' ],
				'permission_callback' => [ $this, 'permission_manage_options' ],
				'args'                => [
					'contentType' => [
						'required'          => true,
						'type'              => 'string',
						'sanitize_callback' => 'sanitize_text_field',
					],
					'taxonomy' => [
						'required'          => false,
						'type'              => 'string',
						'default'           => '',
						'sanitize_callback' => 'sanitize_text_field',
					],
					'term' => [
						'required'          => false,
						'type'              => 'integer',
						'default'           => null,
						'sanitize_callback' => static function ( $param ) {
							return \intval( $param );
						},
					],
					'troubleshooting' => [
						'required'          => false,
						'type'              => 'bool',
						'default'           => null,
						'sanitize_callback' => 'rest_sanitize_boolean',
					],
				],
			],
		]
	);
}