Automattic\WooCommerce\Admin\API

Marketing::register_routes()publicWC 1.0

Register routes.

Method of the class: Marketing{}

No Hooks.

Return

null. Nothing (null).

Usage

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

Marketing::register_routes() code WC 9.3.3

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' ),
		)
	);
}