Skip to content

Instantly share code, notes, and snippets.

@j2machado
Last active July 17, 2025 17:30
Show Gist options
  • Select an option

  • Save j2machado/357664c793bdf2a59224cf4dfa39429c to your computer and use it in GitHub Desktop.

Select an option

Save j2machado/357664c793bdf2a59224cf4dfa39429c to your computer and use it in GitHub Desktop.
LearnDash LMS - Change the Great Job! You've completed this lesson - Keep it going! message.
<?php
/**
* Change the Great Job! You've completed this %s - Keep it going!" message
* for any custom message of your choice using the learndash_alert_message filter.
*
* @param string $message. The message to be filtered.
* @param string $type. The type of message.
* @param string $icon. The message icon.
*
* @return string $message. The filtered message.
*/
add_filter('learndash_alert_message', 'custom_step_completed_message_for_learndash', 10, 3);
function custom_step_completed_message_for_learndash($message, $type, $icon){
// Check the message type. If it is not an "alert" and "step completed", exit early returning $message as is.
if (strpos($type, 'ld-alert--step-completed') === false) {
return $message;
}
// Check the message at least contains "Great Job". If it doesn not, exit early returning $message as is.
if (strpos($message, 'Great Job') === false) {
return $message;
}
// If we reach this step, set our custom "step completed" message.
$message = __( 'Custom congratulations message after completing a step!', 'learndash' );
// Always return $message.
return $message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment