Automattic\WooCommerce\Admin\API

Marketing::register_routes()publicWC 1.0

Register routes.

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

Хуков нет.

Возвращает

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

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

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

Код Marketing::register_routes() WC 9.4.2

public function register_routes() {
	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base . '/recommended',
		array(
			array(
				'methods'             => \WP_REST_Server::READABLE,
				'callback'            => array( $this, 'get_recommended_plugins' ),
				'permission_callback' => array( $this, 'get_recommended_plugins_permissions_check' ),
				'args'                => array(
					'per_page' => $this->get_collection_params()['per_page'],
					'category' => array(
						'type'              => 'string',
						'validate_callback' => 'rest_validate_request_arg',
						'sanitize_callback' => 'sanitize_title_with_dashes',
					),
				),
			),
			'schema' => array( $this, 'get_public_item_schema' ),
		)
	);

	register_rest_route(
		$this->namespace,
		'/' . $this->rest_base . '/knowledge-base',
		array(
			array(
				'methods'             => \WP_REST_Server::READABLE,
				'callback'            => array( $this, 'get_knowledge_base_posts' ),
				'permission_callback' => array( $this, 'get_items_permissions_check' ),
				'args'                => array(
					'category' => array(
						'type'              => 'string',
						'validate_callback' => 'rest_validate_request_arg',
						'sanitize_callback' => 'sanitize_title_with_dashes',
					),
				),
			),
			'schema' => array( $this, 'get_public_item_schema' ),
		)
	);
}