src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php 1 location
|
@@ 379-389 (lines=11) @@
|
376 |
|
* @param WP_REST_Request $request Full details about the request. |
377 |
|
* @return WP_Error|WP_REST_Response Response object on success, or error object on failure. |
378 |
|
*/ |
379 |
|
public function get_item( $request ) { |
380 |
|
$comment = $this->get_comment( $request['id'] ); |
381 |
|
if ( is_wp_error( $comment ) ) { |
382 |
|
return $comment; |
383 |
|
} |
384 |
|
|
385 |
|
$data = $this->prepare_item_for_response( $comment, $request ); |
386 |
|
$response = rest_ensure_response( $data ); |
387 |
|
|
388 |
|
return $response; |
389 |
|
} |
390 |
|
|
391 |
|
/** |
392 |
|
* Checks if a given request has access to create a comment. |
src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php 1 location
|
@@ 353-362 (lines=10) @@
|
350 |
|
* @param WP_REST_Request $request Full details about the request. |
351 |
|
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
352 |
|
*/ |
353 |
|
public function get_item( $request ) { |
354 |
|
$term = $this->get_term( $request['id'] ); |
355 |
|
if ( is_wp_error( $term ) ) { |
356 |
|
return $term; |
357 |
|
} |
358 |
|
|
359 |
|
$response = $this->prepare_item_for_response( $term, $request ); |
360 |
|
|
361 |
|
return rest_ensure_response( $response ); |
362 |
|
} |
363 |
|
|
364 |
|
/** |
365 |
|
* Checks if a request has access to create a term. |
src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php 1 location
|
@@ 395-405 (lines=11) @@
|
392 |
|
* @param WP_REST_Request $request Full details about the request. |
393 |
|
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. |
394 |
|
*/ |
395 |
|
public function get_item( $request ) { |
396 |
|
$user = $this->get_user( $request['id'] ); |
397 |
|
if ( is_wp_error( $user ) ) { |
398 |
|
return $user; |
399 |
|
} |
400 |
|
|
401 |
|
$user = $this->prepare_item_for_response( $user, $request ); |
402 |
|
$response = rest_ensure_response( $user ); |
403 |
|
|
404 |
|
return $response; |
405 |
|
} |
406 |
|
|
407 |
|
/** |
408 |
|
* Retrieves the current user. |