WP_REST_Users_Controller::prepare_links()protectedWP 4.7.0

Prepares links for the user request.

Method of the class: WP_REST_Users_Controller{}

No Hooks.

Return

Array. Links for the given user.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_links( $user );
$user(WP_User) (required)
User object.

Changelog

Since 4.7.0 Introduced.

WP_REST_Users_Controller::prepare_links() code WP 6.5.2

protected function prepare_links( $user ) {
	$links = array(
		'self'       => array(
			'href' => rest_url( sprintf( '%s/%s/%d', $this->namespace, $this->rest_base, $user->ID ) ),
		),
		'collection' => array(
			'href' => rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ),
		),
	);

	return $links;
}