Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_Blocks_Assets::get_course_id()
Returns the current course or lesson’s parent course ID.
Return Return
(int)
Source Source
File: libraries/lifterlms-blocks/includes/class-llms-blocks-assets.php
private static function get_course_id(): int {
$post_type = get_post_type();
$post_id = get_the_ID() ?? 0;
if ( 'lesson' === $post_type ) {
$parent = llms_get_post_parent_course( $post_id );
if ( $parent ) {
$post_id = $parent->get( 'id' );
} else {
return 0;
}
}
return $post_id;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |