# Tutor LMS: Enrolled Student Count in the Courses Admin List

> Adds a "Students" column to the Tutor LMS courses list in wp-admin showing how many students are enrolled in each course.

- Type: PHP
- Runs: Run everywhere
- Category: [Courses & Community](https://wpide.com/library/category/learning/)
- Tags: tutor, admin, reporting
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/tutor-students-column-on-courses/

## Code

```php
if ( ! function_exists( 'tutor_utils' ) ) {
    return;
}

add_filter( 'manage_courses_posts_columns', function ( $columns ) {
    $columns['wpide_tutor_students'] = 'Students';

    return $columns;
} );

add_action( 'manage_courses_posts_custom_column', function ( $column, $course_id ) {
    if ( 'wpide_tutor_students' !== $column ) {
        return;
    }

    $key   = 'wpide_tutor_students_' . $course_id;
    $count = get_transient( $key );

    if ( false === $count ) {
        $count = (int) tutor_utils()->count_enrolled_users_by_course( $course_id );
        set_transient( $key, $count, 6 * HOUR_IN_SECONDS );
    }

    echo esc_html( number_format_i18n( (int) $count ) );
}, 10, 2 );

add_action( 'tutor_after_enrolled', function ( $course_id ) {
    delete_transient( 'wpide_tutor_students_' . (int) $course_id );
} );
```

## Notes

Counts are cached for 6 hours and refreshed when someone enrolls.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Tutor LMS: Enrolled Student Count in the Courses Admin List" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
