apply_filters( 'learndash_show_next_link', bool $show_next_link, int $user_id, int $step_id )
Filters whether to show the next link in the course navigation.
Description #
Parameters #
- $show_next_link
-
(bool) Whether to show next link.
- $user_id
-
(int) User ID.
- $step_id
-
(int) ID of the lesson/topic post.
Source #
Examples #
Note: Extended code example below not guaranteed, you may need to consult with a developer
<?php /** * Example usage for learndash_show_next_link filter. */ add_filter( 'learndash_show_next_link', 'learndash_show_next_link_proc', 10, 3 ); function learndash_show_next_link_proc( $show_next_link = false, $user_id = 0, $post_id = 0 ) { // Example 1) Check if user is admin or group_leader if ( ( user_can( $user_id, 'administrator' ) ) || ( user_can( $user_id, 'group_leader' ) ) ) { $show_next_link = true; } // Example 2) Check post type // $post_type = get_post_type( $post_id ); // if ( $post_type == 'sfwd-lessons') // $show_next_link = true; return $show_next_link; }
Changelog #
Version | Description |
---|---|
2.3.0 | Introduced. |