How to Password Protect Tutor LMS Courses

Requirements:

Once activating our plugin, navigate to Password Protect WordPress >> Settings from your admin dashboard.

  1. Select “Course” and “Lessons” type under Post Type Protection option.
  2. (Optional) If you want to protect a course and its lessons at once with a single password, simply enable “Password Protect Child Pages” option.

In order to hide the entire Tutor course page with a password form, you need to add the following code snippet into your (child) theme’s functions.php file.

add_action('tutor_course/single/lead_meta/before', 'ppwp_maybe_render_password_form', 8 );

function ppwp_maybe_render_password_form() {
     if ( ! is_singular() ) {
         return;
         }
     if ( post_password_required() ) {
         echo get_the_password_form();
         exit();
         }
}
Lasted updated on August 27, 2020