Useful tutor_utils() Functions with Examples
The tutor_utils() helper functions developers use most for settings, enrollment, progress, completion, courses and dashboards, with signatures and examples verified against Tutor LMS 4.1.3.
Checked against the plugin source: Tutor LMS 4.1.3, Tutor LMS Pro 4.1.3

tutor_utils() returns Tutor LMS's main helper object (TUTOR\Utils). It has hundreds of methods, and it also forwards calls to the model classes (courses, lessons, quizzes, withdrawals and enrollments), so tutor_utils()->is_enrolled() works even though the method lives in EnrollmentModel. These are the ones we use most, verified against Tutor LMS 4.1.3.
Always check that Tutor LMS is active before calling it: if ( function_exists( 'tutor_utils' ) ).
Settings
$engine = tutor_utils()->get_option( 'monetize_by' ); // For example 'tutor', 'wc' or 'free'.
get_option( $key, $default = false ) reads one Tutor LMS setting.
Enrollment
is_enrolled( $course_id = 0, $user_id = 0, $is_complete = true ): the enrollment record, orfalse. Passfalseas the third argument to include pending enrollments.get_enrolled_courses_ids_by_user( $user_id = 0 ): IDs of courses the user is enrolled in.count_enrolled_users_by_course( $course_id = 0 ): number of enrolled students.
Full example: check if a user is enrolled.
Progress and completion
get_course_completed_percent( $course_id = 0, $user_id = 0, $get_stats = false ): progress percentage, or an array with counts when$get_statsis true.is_completed_course( $course_id = 0, $user_id = 0 ): the completion record, orfalse.is_completed_lesson( $lesson_id = 0, $user_id = 0 ): whether a lesson is done.get_completed_lesson_count_by_course( $course_id = 0, $user_id = 0 ).get_completed_courses_ids_by_user( $user_id = 0 ).
See getting course progress with PHP.
Course structure
get_topics( $course_id = 0 ): the course topics.get_course_contents_by_id( $course_id = 0 ): lessons, quizzes and assignments in the course.get_course_id_by( $content, $object_id ): the course a lesson, quiz, assignment or topic belongs to.$contentis a type such as'lesson','quiz','assignment'or'topic'.
Prices and purchase
is_course_purchasable( $course_id = 0 ): whether the course is paid.get_course_price( $course_id = 0 ): the price as shown on the site.
Users and dashboards
is_instructor( $user_id = 0, $is_approved = false ): passtrueto require an approved instructor.tutor_dashboard_url( $sub_url = '' ): the dashboard URL, optionally for a sub-page.
Example: a "continue learning" link for the current user
function tle_continue_learning_html() {
if ( ! function_exists( 'tutor_utils' ) || ! is_user_logged_in() ) {
return '';
}
$html = '';
foreach ( tutor_utils()->get_enrolled_courses_ids_by_user() as $course_id ) {
if ( tutor_utils()->is_completed_course( $course_id ) ) {
continue;
}
$percent = (int) tutor_utils()->get_course_completed_percent( $course_id );
$html .= sprintf(
'<li><a href="%s">%s</a> (%d%%)</li>',
esc_url( get_permalink( $course_id ) ),
esc_html( get_the_title( $course_id ) ),
$percent
);
}
return $html ? '<ul>' . $html . '</ul>' : '';
}
Notes
- A
0user ID means "the current user", and a0course ID means "the current post" in most of these functions. - Many results are cached per request, so they are cheap to call more than once.
- Method names change rarely, but check them after major updates.
Building on Tutor LMS data? Our plugin development team can help.
Save this practical guide
Add us as a preferred Google source, or ask an AI assistant to summarize this page and link back to the original guide when it is useful.
