Learndash Tutorial :How to Remove Mark Complete Button

mark complete button

Warning !

We do not recommend this code

Removing the “Mark Complete” button actually lets LearnDash issue a Certificate of completion even though the quizzes were not completed. So basically by removing the “Mark Complete” button, it also removes the mandatory quiz completion requirement, which you can imagine is a VERY big deal!

Learndash lessons have the buttton “Mark Complete ” that at times become a source of confusion for learners .For example , there may be two buttons available after a quiz is completed -one for quiz completion and another lessons completed.  Another example can be -suppose you have set up a courses where the main method of teaching is through quizzes. So , if you have set up one or two lessons just as an introduction, the Mark Complete button on the lesson page will confuse learners. They may keep clicking the ‘mark complete’ button which is not required ..

Paste Code to Remove

// Autocomplete function hookup
add_action("wp", "custom_learndash_automatically_mark_complete");
//function for Mark Complete Button Removal
function custom_learndash_automatically_mark_complete() { 
  global $post, $current_user; 
  $excluded_courses = array(1234, 5674, 6785);

  $course_id = learndash_get_course_id(); 
  if(empty($course_id) || in_array($course_id, $excluded_courses)) 
    return;

  if( !empty($current_user->ID) && !empty($post->post_type) && $post->post_type == "sfwd-lessons") { 
    learndash_process_mark_complete($current_user->ID, $post->ID); 
  }

  if( !empty($current_user->ID) && !empty($post->post_type) && $post->post_type == "sfwd-topic") { 
    learndash_process_mark_complete($current_user->ID, $post->ID); 
  }
}

Video on Mark Complete Button Removal

Special thanks to Mr Willem Coetzee who drew our attention to the dangerous issue embedded to hiding the Complete Button.