WP_REST_Users_Controller::prepare_links
Prepares links for the user request.
Method of the class: WP_REST_Users_Controller{}
No Hooks.
Returns
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() WP REST Users Controller::prepare links code WP 6.9.1
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;
}