Retrieves a collection of posts.
public get_items ( WP_REST_Request $request ) : WP_REST_Response | WP_Error | ||
$request | WP_REST_Request | Full details about the request. |
리턴 | WP_REST_Response | WP_Error | Response object on success, or WP_Error object on failure. |
/** * Get all graph data items * @param WP_REST_Request $request The current request * @return Array|WP_Error */ public function get_items($request) { $result = array(); // Fetch all skills $request->set_param('per_page', -1); $allSkills = parent::get_items($request); // Filter all skills to only return the ones tagged as starting skills foreach ($allSkills->data as $skill) { if ($skill['starting_skill']) { $result[] = $skill; } } return $result; }