Skip to content

Hooks & Filters Reference

All hooks use the ld_dashboard_ prefix. Hooks are available since version 7.5.0 unless noted.


Fires during init (priority 20) to allow registration of custom table reports.

Parameters:

Parameter Type Description
$registry LD_Dashboard_Report_Registry The report registry instance

Location: includes/reports/class-ld-dashboard-report-registry.php

Example:

add_action( 'ld_dashboard_register_reports', function( $registry ) {
LD_Dashboard_Report_Registry::register( 'my-report', 'My_Custom_Report' );
} );

Fires during init (priority 20) to allow registration of custom Chart.js charts.

Parameters:

Parameter Type Description
$registry LD_Dashboard_Report_Registry The report registry instance

Location: includes/reports/class-ld-dashboard-report-registry.php

Example:

add_action( 'ld_dashboard_register_charts', function( $registry ) {
LD_Dashboard_Report_Registry::register( 'my-chart', 'My_Custom_Chart' );
} );

Fires when the module registry boots, before built-in modules are initialized. Register custom modules here.

Parameters:

Parameter Type Description
$registry LD_Dashboard_Module_Registry The module registry instance

Location: includes/modules/class-ld-dashboard-module-registry.php

Example:

add_action( 'ld_dashboard_register_modules', function( $registry ) {
$registry->register( 'my-module', 'My_Custom_Module' );
} );

Fires after a module successfully boots (dependencies met and boot() called).

Parameters:

Parameter Type Description
$module LD_Dashboard_Module_Base The loaded module instance

Location: includes/modules/class-ld-dashboard-module-base.php

Example:

add_action( 'ld_dashboard_module_loaded', function( $module ) {
if ( 'zoom' === $module->get_id() ) {
// Zoom is active.
}
} );

There is also a module-specific variant: ld_dashboard_module_{module_id}_loaded.


Fires before the module registry iterates and boots registered modules.

Parameters:

Parameter Type Description
$registry LD_Dashboard_Module_Registry The registry instance

Fires after all modules have been booted.

Parameters:

Parameter Type Description
$registry LD_Dashboard_Module_Registry The registry instance
$modules array Array of active module instances

Fires after an email is sent via ld_dashboard_send_email().

Parameters:

Parameter Type Description
$sent bool Whether the email was sent successfully
$template_id string Email template ID
$to string Recipient email address
$args array Template arguments passed to the email

Location: includes/emails/class-ld-dashboard-email-template.php

There is also a template-specific variant: ld_dashboard_email_sent_{template_id}.


Fires after any save handler completes. This generic hook fires for every content type.

Parameters:

Parameter Type Description
$post_id int Saved post ID
$form array Full sanitized form data submitted
$meta_data array Meta data saved to the post
$handler string Handler ID (e.g., course, lesson, quiz)

Location: includes/save-handlers/class-ld-dashboard-save-handler-base.php

Example:

add_action( 'ld_dashboard_after_save', function( $post_id, $form, $meta_data, $handler ) {
if ( 'course' === $handler ) {
// Run after any course save.
}
}, 10, 4 );

Fires after a course is saved via the save handler.

Parameters:

Parameter Type Description
$post_id int Saved course post ID
$meta_data array Meta data saved to the post

Location: includes/save-handlers/class-ld-dashboard-save-handler-course.php

Example:

add_action( 'ld_dashboard_after_course_save', function( $post_id, $meta_data ) {
// Sync course to external system.
}, 10, 2 );

Fires after a lesson is saved via the save handler.

Parameters:

Parameter Type Description
$post_id int Saved lesson post ID
$meta_data array Meta data saved to the post
$course_id int Associated course ID

Location: includes/save-handlers/class-ld-dashboard-save-handler-lesson.php


Fires after a topic is saved via the save handler.

Parameters:

Parameter Type Description
$post_id int Saved topic post ID
$meta_data array Meta data saved to the post
$course_id int Associated course ID
$lesson_id int Associated lesson ID

Location: includes/save-handlers/class-ld-dashboard-save-handler-topic.php

Example:

add_action( 'ld_dashboard_after_topic_save', function( $post_id, $meta_data, $course_id, $lesson_id ) {
// React to topic save with full hierarchy context.
}, 10, 4 );

Fires after a quiz is saved via the save handler.

Parameters:

Parameter Type Description
$post_id int Saved quiz post ID
$meta_data array Meta data saved to the post
$course_id int Associated course ID

Location: includes/save-handlers/class-ld-dashboard-save-handler-quiz.php


Fires after a question is saved via the save handler.

Parameters:

Parameter Type Description
$post_id int Saved question post ID
$meta_data array Meta data saved to the post
$quiz_id int Associated quiz post ID

Location: includes/save-handlers/class-ld-dashboard-save-handler-question.php


Fires after a certificate is saved via the save handler.

Parameters:

Parameter Type Description
$post_id int Saved certificate post ID
$meta_data array Meta data saved to the post

Location: includes/save-handlers/class-ld-dashboard-save-handler-certificate.php


Fires after a LearnDash group is saved via the save handler.

Parameters:

Parameter Type Description
$post_id int Saved group post ID
$meta_data array Meta data saved to the post

Location: includes/save-handlers/class-ld-dashboard-save-handler-group.php


Fires after an announcement is saved via the save handler.

Parameters:

Parameter Type Description
$post_id int Saved announcement post ID
$meta_data array Meta data saved to the post
$course_id int Associated course ID (0 if none or unauthorized)

Location: includes/save-handlers/class-ld-dashboard-save-handler-announcement.php


Fires after all built-in reports and charts are registered. Use this hook to register custom reports.

Parameters:

Parameter Type Description
$registry LD_Dashboard_Report_Registry The report registry instance

Location: includes/reports/index.php

Example:

add_action( 'ld_dashboard_reports_registered', function( $registry ) {
LD_Dashboard_Report_Registry::register( 'my-report', 'My_Custom_Report' );
} );

Filters report row data after role-based access filtering but before the response is built. Applies to all table reports.

Parameters:

Parameter Type Description
$data array Report data rows
$report_id string Report identifier (e.g., quiz-results)
$args array Query arguments used to fetch the data

Returns: array Modified report rows.

Location: includes/reports/class-ld-dashboard-report-base.php

Example:

add_filter( 'ld_dashboard_report_data', function( $data, $report_id, $args ) {
if ( 'quiz-results' === $report_id ) {
// Remove rows with zero score.
return array_filter( $data, fn( $row ) => $row['score'] > 0 );
}
return $data;
}, 10, 3 );

There is also a report-specific variant: ld_dashboard_report_{report_id}_data.


Filters the array of registered tab classes. Use this to add, replace, or remove tabs.

Parameters:

Parameter Type Description
$tabs array Array of tab_id => class_name pairs

Returns: array Modified tabs array.

Location: includes/tabs/class-ld-dashboard-tab-registry.php

Example:

add_filter( 'ld_dashboard_registered_tabs', function( $tabs ) {
$tabs['gradebook'] = 'My_Gradebook_Tab';
return $tabs;
} );

Filters WP_Query arguments before the tab executes its query. Replace the tab ID placeholder with the tab slug (e.g., lesson, quiz).

Parameters:

Parameter Type Description
$args array WP_Query arguments

Returns: array Modified query arguments.

Location: includes/tabs/class-ld-dashboard-tab-base.php

Example:

add_filter( 'ld_dashboard_lesson_content_args', function( $args ) {
$args['meta_key'] = 'featured';
$args['meta_value'] = '1';
return $args;
} );

Filters the rendered HTML content for a tab after all items are rendered.

Parameters:

Parameter Type Description
$content string Rendered HTML

Returns: string Modified HTML.


Filters the registered email type configurations. Use this to add custom email types or modify existing ones.

Parameters:

Parameter Type Description
$email_types array Array of email type configurations

Returns: array Modified email types.

Location: includes/emails/class-ld-dashboard-email-template.php

Example:

add_filter( 'ld_dashboard_email_types', function( $types ) {
$types['my_custom_email'] = array(
'title' => __( 'My Custom Email', 'my-plugin' ),
'template' => 'custom/my-email.php',
'subject' => __( 'Hello, {user_name}', 'my-plugin' ),
);
return $types;
} );

ld_dashboard_email_recipient_{template_id}

Section titled “ld_dashboard_email_recipient_{template_id}”

Filters the recipient email address for a specific template before sending. Replace the template ID placeholder with the template ID (e.g., instructor_approved).

Parameters:

Parameter Type Description
$to string Recipient email address
$template_id string Email template ID
$args array Template arguments

Returns: string Modified recipient address.

There is also a generic variant ld_dashboard_email_recipient that fires for every template (same parameters).

Location: includes/emails/class-ld-dashboard-email-template.php

Example:

add_filter( 'ld_dashboard_email_recipient_instructor_approved', function( $to, $template_id, $args ) {
// Redirect approvals to a custom address in staging.
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
return 'dev@example.com';
}
return $to;
}, 10, 3 );

Filters the email subject for a specific template before sending. Replace the template ID placeholder with the template ID.

Parameters:

Parameter Type Description
$subject string Email subject with merge tags replaced
$template_id string Email template ID
$args array Template arguments

Returns: string Modified subject.

There is also a generic variant ld_dashboard_email_subject that fires for every template (same parameters).

Location: includes/emails/class-ld-dashboard-email-template.php

Example:

add_filter( 'ld_dashboard_email_subject_instructor_approved', function( $subject ) {
return '[' . get_bloginfo( 'name' ) . '] ' . $subject;
} );

Filters the rendered email body HTML for a specific template before the header/footer wrapper is applied. Replace the template ID placeholder with the template ID.

Parameters:

Parameter Type Description
$content string Rendered HTML content
$template_id string Email template ID
$args array Template arguments

Returns: string Modified HTML content.

There is also a generic variant ld_dashboard_email_content that fires for every template (same parameters).

Location: includes/emails/class-ld-dashboard-email-template.php


Filters email headers for a specific template. Replace the template ID placeholder with the template ID.

Parameters:

Parameter Type Description
$headers array Email headers array
$template_id string Email template ID
$args array Template arguments

Returns: array Modified headers.

There is also a generic variant ld_dashboard_email_headers that fires for every template (same parameters).

Location: includes/emails/class-ld-dashboard-email-template.php

Example:

add_filter( 'ld_dashboard_email_headers_instructor_approved', function( $headers ) {
$headers[] = 'CC: admin@example.com';
return $headers;
} );

Filters all available merge tag values before replacement in email content and subjects.

Parameters:

Parameter Type Description
$tags array Merge tag key-value pairs
$content string Content being processed
$args array Original template arguments

Returns: array Modified merge tags.

Example:

add_filter( 'ld_dashboard_email_merge_tags', function( $tags, $content, $args ) {
$tags['custom_field'] = get_option( 'my_custom_value' );
return $tags;
}, 10, 3 );

Filters the HTML of the email header wrapper (output of email-header.php).

Parameters:

Parameter Type Description
$header string Email header HTML

Returns: string Modified HTML.


Filters the HTML of the email footer wrapper (output of email-footer.php).

Parameters:

Parameter Type Description
$footer string Email footer HTML

Returns: string Modified HTML.


Filters the complete chart response array for a specific chart.

Parameters:

Parameter Type Description
$response array Chart response with id, chartData, options, meta
$args array Query arguments

Returns: array Modified chart response.


Filters the From email address used in all plugin emails.

Parameters:

Parameter Type Description
$from_email string From email address (defaults to WordPress admin email)

Returns: string Modified From address.


Filters the From name used in all plugin emails.

Parameters:

Parameter Type Description
$from_name string From name (defaults to site name)

Returns: string Modified From name.