LMS & eLearning

Adding Columns and Filters to the LearnDash Admin Course and Group Lists

LearnDash builds its admin list tables through a listing class with two filters: learndash_listing_columns for columns and learndash_listing_selectors for dropdown filters. How each array is shaped.

Adding Columns and Filters to the LearnDash Admin Course and Group Lists

The Courses, Lessons, Quizzes and Groups screens in the LearnDash admin are standard WordPress list tables, but LearnDash does not add its columns and filter dropdowns with the raw WordPress hooks. It routes them through a listing class per post type, Learndash_Admin_Posts_Listing and its subclasses, which exposes two filters: one for columns and one for the selector dropdowns above the table. Using those filters instead of manage_posts_columns puts your additions in the same order and style as LearnDash's own, lets the dropdowns participate in the same query handling, and respects group leader scoping. This guide covers both filters in LearnDash 4.18.0.1 with worked examples: an enrolled count column on courses, a seats column on groups, and a price type filter already built in that shows the selector format.

How the listing class builds a screen

Each listing subclass sets its post type and, in listing_init(), fills two arrays. $this->selectors describes the filter dropdowns and $this->columns describes extra columns. Both pass through filters, learndash_listing_selectors( $selectors, $post_type ) and learndash_listing_columns( $columns, $post_type ), and are then registered: columns are inserted into the WordPress column list relative to an existing column, and each column's display callable is invoked from the manage_{post_type}_posts_custom_column hook with the post ID and column name. The courses listing, for example, defines a Price Type column placed after Title with show_column_price_type() as its display callback, and four selectors: author, group, certificate and price type.

Adding a column

A column entry has four keys: label, the header text; after, the key of the existing column to insert after, such as title; display, a callable receiving $post_id and $column_name that echoes the cell; and required, which prevents the column from being hidden in Screen Options. The following adds an Enrolled column to courses showing the direct enrolment count, and a Seats column to groups showing used and total seats where the group sells seats.

<?php
add_filter(
    'learndash_listing_columns',
    function ( $columns, $post_type ) {
        if ( learndash_get_post_type_slug( 'course' ) === $post_type ) {
            $columns['acme_enrolled'] = array(
                'label'   => 'Enrolled',
                'after'   => 'price_type',
                'display' => function ( $post_id, $column_name ) {
                    $query = learndash_get_users_for_course( $post_id, array( 'fields' => 'ID' ), false );
                    $count = ( $query instanceof WP_User_Query ) ? (int) $query->get_total() : 0;
                    echo esc_html( number_format_i18n( $count ) );
                },
            );
        }

        if ( learndash_get_post_type_slug( 'group' ) === $post_type ) {
            $columns['acme_seats'] = array(
                'label'   => 'Seats',
                'after'   => 'title',
                'display' => function ( $post_id, $column_name ) {
                    $total = (int) learndash_get_setting( $post_id, 'group_seats_limit' );
                    $used  = count( (array) learndash_get_groups_user_ids( $post_id ) );
                    if ( $total > 0 ) {
                        echo esc_html( $used . ' of ' . $total );
                    } else {
                        echo esc_html( (string) $used );
                    }
                },
            );
        }

        return $columns;
    },
    10,
    2
);

Because the display callback runs once per row, keep it cheap. learndash_get_users_for_course() runs a user query per course; on a site with hundreds of courses, cache the count in a transient keyed by course ID and clear it on the learndash_update_course_access action. The enrolment functions reference describes both.

Making a column sortable

The listing class does not manage sorting, so use WordPress for that part: register the column as sortable on manage_edit-{post_type}_sortable_columns, and on pre_get_posts in the admin, when orderby matches your key, set a meta_key and orderby=meta_value_num. That only works when the value is stored in post meta, which argues for storing the enrolled count as meta updated by the enrolment action rather than computing it per row.

Adding a selector

Selectors are dropdowns above the table whose selection filters the query. The built-in types are user, post_type, taxonomy and early, the last meaning a custom dropdown you render yourself through a display callable. The useful keys, as the courses listing uses them, are show_all_value and show_all_label for the default option, show_empty_value and show_empty_label for a "none" option, options for a fixed list, listing_query_function, a callable receiving the query vars and the selector that returns modified query vars, selector_filter_function to adjust the dropdown's own query, selector_value_function to transform the selected value, and select2 to use the searchable dropdown. This example adds a Cohort selector to courses backed by a _cohort post meta value.

<?php
add_filter(
    'learndash_listing_selectors',
    function ( $selectors, $post_type ) {
        if ( learndash_get_post_type_slug( 'course' ) !== $post_type ) {
            return $selectors;
        }

        $selectors['acme_cohort'] = array(
            'type'                   => 'early',
            'show_all_value'         => '',
            'show_all_label'         => 'All Cohorts',
            'options'                => array(
                '2026-spring' => 'Spring 2026',
                '2026-autumn' => 'Autumn 2026',
            ),
            'select2'                => true,
            'select2_fetch'          => false,
            'display'                => function ( $selector ) {
                $current = isset( $_GET['acme_cohort'] ) ? sanitize_text_field( wp_unslash( $_GET['acme_cohort'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
                echo '<select name="acme_cohort" class="postform">';
                echo '<option value="">' . esc_html( $selector['show_all_label'] ) . '</option>';
                foreach ( $selector['options'] as $value => $label ) {
                    echo '<option value="' . esc_attr( $value ) . '"' . selected( $current, $value, false ) . '>' . esc_html( $label ) . '</option>';
                }
                echo '</select>';
            },
            'listing_query_function' => function ( $q_vars, $selector ) {
                $current = isset( $_GET['acme_cohort'] ) ? sanitize_text_field( wp_unslash( $_GET['acme_cohort'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
                if ( '' !== $current ) {
                    $q_vars['meta_key']   = '_cohort';
                    $q_vars['meta_value'] = $current;
                }
                return $q_vars;
            },
        );

        return $selectors;
    },
    10,
    2
);

For a dropdown of posts, set type to post_type with a post_type key, and LearnDash renders a searchable selector with its own AJAX fetch; the group selector on the courses screen is built that way. For a user dropdown, type is user. In both cases you supply listing_query_function to translate the selection into query vars, exactly as above.

Removing or reordering built-ins

The same filters let you unset LearnDash's columns and selectors, for instance removing the certificate selector on a site that does not use certificates, or hiding the Price Type column for group leaders. Check learndash_is_group_leader_user() inside the filter when the change should apply to leaders only; the listing class already removes the empty-group option for leaders with limited group management, so your additions should follow the same care.

When to get help

A column or a selector is an hour's work. Admin screens that join LearnDash data with sales or CRM data, bulk actions on filtered lists, or performance work on sites with thousands of courses are tasks for our LearnDash services team and LearnDash development practice, and a LearnDash developer can also build the cached counts that make such columns cheap.

Frequently asked questions

Which filter adds a column to the LearnDash courses list?

learndash_listing_columns, receiving the columns array and the post type. Each entry needs label, after and a display callable that echoes the cell.

How do I add a filter dropdown above a LearnDash list?

Add an entry to learndash_listing_selectors with a type of user, post_type, taxonomy or early and a listing_query_function that applies the selection to the query vars.

Can I use the standard WordPress column hooks instead?

Yes, but columns added that way are not ordered relative to LearnDash's and do not share its selector handling. Use LearnDash's filters for consistency.

Why is my column slow?

The display callback runs per row. Avoid per-row queries by storing the value in post meta or caching it in a transient.

Add WorldWin Coder to your preferred sources

Add worldwincoder.com as a preferred source on Google, or open this article in your AI assistant to use it as a source.

· Developers and project managers

Articles written and reviewed by the developers and project managers at WorldWin Coder, who build and maintain websites, web applications and mobile apps on WordPress, Moodle, PHP, Laravel, CodeIgniter and Flutter.

Keep reading

Have something to build, fix or move?

Tell us where you are. A developer reads every inquiry, and you get next steps and a free quote within one business day.