Browse: Home / Functions /

learndash_course_get_linear_step_ids

learndash_course_get_linear_step_ids( int $course_id,  WP_User|int|null $user = null )

Returns all step ids for a course in a linear (flattened) array.


Description #

Steps that are not visible to the user (e.g. drafts for a regular student) are filtered out, so navigation and "Resume Course" never land on an inaccessible step.


Parameters #

$course_id

(int) (Required) Course post ID.

$user

(WP_User|int|null) (Optional) The user to control steps visibility. If null or empty, the current user is used.

Default value: null


Return #

(int[]) Array of step IDs.


Source #

File: includes/course/ld-course-steps-functions.php


Changelog #

Changelog
Version Description
5.1.5 Added the $user parameter and visibility filtering, delegating to the Course model.
4.11.0 Introduced.