Hooks & Filters Reference
All hooks use the ld<em>dashboard</em> prefix. Hooks are available since version 7.5.0 unless noted.
Actions
ld<em>dashboard</em>register_reports
Fires during init (priority 20) to allow registration of custom table reports.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$registry | LD<em>Dashboard</em>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' );
} );
ld<em>dashboard</em>register_charts
Fires during init (priority 20) to allow registration of custom Chart.js charts.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$registry | LD<em>Dashboard</em>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' );
} );
ld<em>dashboard</em>register_modules
Fires when the module registry boots, before built-in modules are initialized. Register custom modules here.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$registry | LD<em>Dashboard</em>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' );
} );
ld<em>dashboard</em>module_loaded
Fires after a module successfully boots (dependencies met and boot() called).
Parameters:
| Parameter | Type | Description |
|---|---|---|
$module | LD<em>Dashboard</em>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<em>dashboard</em>module<em>{module</em>id}_loaded.
ld<em>dashboard</em>before<em>modules</em>boot
Fires before the module registry iterates and boots registered modules.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$registry | LD<em>Dashboard</em>Module_Registry | The registry instance |
ld<em>dashboard</em>modules_booted
Fires after all modules have been booted.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$registry | LD<em>Dashboard</em>Module_Registry | The registry instance |
$modules | array | Array of active module instances |
ld<em>dashboard</em>email_sent
Fires after an email is sent via ld<em>dashboard</em>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<em>dashboard</em>email<em>sent</em>{template_id}.
ld<em>dashboard</em>after_save
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 );
ld<em>dashboard</em>after<em>course</em>save
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 );
ld<em>dashboard</em>after<em>lesson</em>save
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
ld<em>dashboard</em>after<em>topic</em>save
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 );
ld<em>dashboard</em>after<em>quiz</em>save
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
ld<em>dashboard</em>after<em>question</em>save
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
ld<em>dashboard</em>after<em>certificate</em>save
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
ld<em>dashboard</em>after<em>group</em>save
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
ld<em>dashboard</em>after<em>announcement</em>save
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
ld<em>dashboard</em>reports_registered
Fires after all built-in reports and charts are registered. Use this hook to register custom reports.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$registry | LD<em>Dashboard</em>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
ld<em>dashboard</em>report_data
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<em>dashboard</em>report<em>{report</em>id}_data.
ld<em>dashboard</em>registered_tabs
Filters the array of registered tab classes. Use this to add, replace, or remove tabs.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$tabs | array | Array of tab<em>id => class</em>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;
} );
ld<em>dashboard</em>{tab<em>id}</em>content_args
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;
} );
ld<em>dashboard</em>{tab<em>id}</em>content
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.
ld<em>dashboard</em>email_types
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<em>dashboard</em>email<em>recipient</em>{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<em>dashboard</em>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 );
ld<em>dashboard</em>email<em>subject</em>{template_id}
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<em>dashboard</em>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;
} );
ld<em>dashboard</em>email<em>content</em>{template_id}
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<em>dashboard</em>email_content that fires for every template (same parameters).
Location: includes/emails/class-ld-dashboard-email-template.php
ld<em>dashboard</em>email<em>headers</em>{template_id}
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<em>dashboard</em>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;
} );
ld<em>dashboard</em>email<em>merge</em>tags
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 );
ld<em>dashboard</em>email_header
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.
ld<em>dashboard</em>email_footer
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.
ld<em>dashboard</em>chart<em>{chart</em>id}_data
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.
ld<em>dashboard</em>email<em>from</em>address
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.
ld<em>dashboard</em>email<em>from</em>name
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.
