WP_REST_Users_Controller::prepare_links( WP_User $user ): array

In this article

Prepares links for the user request.

Parameters

$userWP_Userrequired
User object.

Return

array Links for the given user.

Source

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;
}

Changelog

VersionDescription
4.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.