WP_REST_Global_Styles_Revisions_Controller::register_routes()publicWP 6.3.0

Registers the controller's routes.

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

Хуков нет.

Возвращает

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

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

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

Список изменений

С версии 6.3.0 Введена.
С версии 6.6.0 Added route to fetch individual global styles revisions.

Код WP_REST_Global_Styles_Revisions_Controller::register_routes() WP 6.7.1

public function register_routes() {
	register_rest_route(
		$this->namespace,
		'/' . $this->parent_base . '/(?P<parent>[\d]+)/' . $this->rest_base,
		array(
			'args'   => array(
				'parent' => array(
					'description' => __( 'The ID for the parent of the revision.' ),
					'type'        => 'integer',
				),
			),
			array(
				'methods'             => WP_REST_Server::READABLE,
				'callback'            => array( $this, 'get_items' ),
				'permission_callback' => array( $this, 'get_items_permissions_check' ),
				'args'                => $this->get_collection_params(),
			),
			'schema' => array( $this, 'get_public_item_schema' ),
		)
	);

	register_rest_route(
		$this->namespace,
		'/' . $this->parent_base . '/(?P<parent>[\d]+)/' . $this->rest_base . '/(?P<id>[\d]+)',
		array(
			'args'   => array(
				'parent' => array(
					'description' => __( 'The ID for the parent of the global styles revision.' ),
					'type'        => 'integer',
				),
				'id'     => array(
					'description' => __( 'Unique identifier for the global styles revision.' ),
					'type'        => 'integer',
				),
			),
			array(
				'methods'             => WP_REST_Server::READABLE,
				'callback'            => array( $this, 'get_item' ),
				'permission_callback' => array( $this, 'get_item_permissions_check' ),
				'args'                => array(
					'context' => $this->get_context_param( array( 'default' => 'view' ) ),
				),
			),
			'schema' => array( $this, 'get_public_item_schema' ),
		)
	);
}