LLMS_REST_Posts_Controller::get_object( int $id )
Get object.
Parameters Parameters
- $id
-
(int) (Required) Object ID.
Return Return
(LLMS_Course|WP_Error)
Source Source
File: libraries/lifterlms-rest/includes/abstracts/class-llms-rest-posts-controller.php
protected function get_object( $id ) {
$class = $this->llms_post_class_from_post_type();
if ( ! $class ) {
return new WP_Error(
'llms_rest_cannot_get_object',
/* translators: %s: post type */
sprintf( __( 'The %s cannot be retrieved.', 'lifterlms' ), $this->post_type ),
array( 'status' => 500 )
);
}
$object = llms_get_post( $id );
return $object && is_a( $object, $class ) ? $object : llms_rest_not_found_error();
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0-beta.9 | Introduced. |