BP_REST_Learndash_Courses_Endpoint::prepare_links( WP_Post $course )
Prepare links for the request.
Description
Parameters
- $course
-
(Required) Course object.
Return
(array) Links for the given plugin.
Source
File: bp-integrations/learndash/classes/class-bp-rest-learndash-courses-endpoint.php
protected function prepare_links( $course ) {
$base = sprintf( '/%s/%s/', $this->namespace, $this->rest_base );
// Entity meta.
$links = array(
'collection' => array(
'href' => rest_url( $base ),
),
'user' => array(
'href' => rest_url( bp_rest_get_user_url( $course->post_author ) ),
'embeddable' => true,
),
);
/**
* Filter links prepared for the REST response.
*
* @param array $links The prepared links of the REST response.
* @param WP_post $course Course object.
*
* @since 0.1.0
*/
return apply_filters( 'bp_rest_learndash_course_prepare_links', $links, $course );
}
Changelog
| Version | Description |
|---|---|
| 0.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.