How to Restrict Course Materials to Enrolled Users Only

By default, all information and/or materials you add to the Materials tab in a LearnDash course is displayed to ALL visitors of your site, even those not enrolled in that course. But what if you want the materials to only be available to enrolled users?

LearnDash doesn’t offer a simple option, setting or checkbox to enable this, but you do have a few options. We’ll cover two common techniques you can use to protect your LearnDash materials.

Place Materials in Lessons Instead

One common solution is to place your materials in the first lesson of your course, instead of adding them to the course itself. Lessons are automatically protected by default, and only accessible to those who have access to the course. So an unenrolled user will never be able to see or access them.

You may want to create a new lesson that is dedicated to materials for the course, or you can include materials in multiple lessons throughout your course. It’s entirely up to you, and how your course is laid out.

Use the [student] Shortcode

If you want to keep materials in the course (and not move them to a lesson), you can utilize the [student] shortcode that LearnDash provides.

The [student] shortcode actually has beginning and ending shortcodes, and all content placed between the beginning and ending shortcode will only be shown to enrolled users. Here’s a quick example:

[student]Only enrolled users can see this.[/student]

You can insert your course material just like you normally would, linking to a PDF, audio file, some other download, etc. Once you’ve added it to the materials section, simply add [student] to the front of it and [/student] at the end. Update your page and test it out.

When viewing the course page logged in as an admin, you should see the material. If you open the same course page in a private browsing window, or a different browser, not logged in, you will not see it.

The [visitor] Shortcode

You can also combine this technique with the [visitor] and [/visitor] shortcodes. All content inside of these shortcodes will only be shown to unenrolled users. So you could say something like this:

[visitor]Materials are only available to enrolled students. Buy this course →[/visitor]

You can add a link to a product page or membership sign up to encourage visitors to purchase access to the course.


If you have any other tips for protecting LearnDash course materials, we’d love to hear about them over in the forum.

Author
Dave Warfel

Dave Warfel

I've been working with LearnDash for over 3.5 years, and have developed 3 free & 2 premium plugins for WordPress' most popular LMS. Nothing brings me more joy than empowering others to take control of their online platform. I live, work & play in the beautiful mountains of Colorado. 🤸‍♂️👨‍💻🏃‍♂️🏔️

Forum Rules

Be Kind & Patient

We’re here to learn and/or help each other. Please don’t be mean, rude, or condescending. Treat all members the way you should be treating dogs and your elders—with the utmost love & respect.

External Links

✅ Other websites that add value, help solve problems & contribute to the discussion. ❌ Affiliate links are prohibited. (Site owners may use affiliate links to help support the site.)

Promotion

✅ You may promote your own products/services if they are relevant to an existing discussion. You must disclose your relationship with the product(s).
❌ You may not create new posts simply to promote your products.

Non-LearnDash Topics

❌ General (free) Forum: Only LearnDash-specific topics are allowed.
✅ Premium Forums: You are allowed to post other questions tangentially related to LearnDash. Please use the appropriately named forum. If it doesn’t exist, use the “LearnDash Integrations” forum.

Our Right to Remove

We reserve the right to remove any content, at any time, for any reason. We can also merge one post with another. We will exercise caution when removing content and always try to provide an explanation.