WP_REST_Application_Passwords_Controller::prepare_links()protectedWP 5.6.0

Prepares links for the request.

Method of the class: WP_REST_Application_Passwords_Controller{}

No Hooks.

Return

Array. The list of links.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_links( $user, $item );
$user(WP_User) (required)
The requested user.
$item(array) (required)
The application password.

Changelog

Since 5.6.0 Introduced.

WP_REST_Application_Passwords_Controller::prepare_links() code WP 6.6.2

protected function prepare_links( WP_User $user, $item ) {
	return array(
		'self' => array(
			'href' => rest_url(
				sprintf(
					'%s/users/%d/application-passwords/%s',
					$this->namespace,
					$user->ID,
					$item['uuid']
				)
			),
		),
	);
}