Browse: Home / Hooks /


apply_filters( 'learndash_lesson_sample_access',  bool $access,  int $lesson_id,  int $post_id,  int $user_id )

Filters whether to allow access to the sample lesson or not.

Description #

By default a sample lesson is available even to anonymous users. This filter will override that access. The filer ‘learndash_can_access_sample’ is also used themes/ld30/templates/lesson/partials/row.php to control visibility of the lesson and sub-steps.

Parameters #


(bool) Access status true if the user can access $post_id.


(int) Lesson ID.


(int) Course step the user is trying to access.


(int) User ID.

Source #

File: themes/ld30/includes/helpers.php

Examples #

Note: Extended code example below not guaranteed, you may need to consult with a developer

 * Example usage for learndash_lesson_sample_access filter.
	function( $access, $post_id, $user_id ) {
		// May add any custom logic using $access, $post_id, $user_id.

		// Always return $access.
		return $access;

Changelog #

Version Description
3.2.0 Introduced.