How to do: Lock LearnDash Lessons with Code

One way to lock lessons is to use a filter. This code example triggers when a LearnDash lesson is loading. During the loading process if the lesson which is loading has its post id in the “lock list” the code sends back a “Lesson Locked” div with a child p tag both of which can be customized as you wish and styled by CSS. If it is not in the list it returns the normal lesson content.