Browse: Home / Functions /

learndash_next_post_link

learndash_next_post_link( string|null $default_value = '',  string|bool $url = false,  WP_Post|null $post = null,  WP_User|int|null $user = null )

Generates the next post link/url/ID for a lesson/topic/quiz in a course.


Description #

Important note: learndash_clear_prev_next_links() affects it via learndash_next_post_link hook. For some historical reason, it affects the link case only, not ID or URL.


Parameters #

$default_value

(string|null) (Optional) Default next post link. Null type is added for backward compatibility.

Default value: ''

$url

(string|bool) (Optional) Whether to return URL or ID instead of HTML output. If true, the URL is returned. If 'id', ID is returned. Otherwise, an HTML link is returned.

Default value: false

$post

(WP_Post|null) (Optional) Current post. If not passed, the global post object is used.

Default value: null

$user

(WP_User|int|null) (Optional) Current user to control steps visibility. If null or empty, the current user is used.

Default value: null


Return #

(string|int) Next post link URL or HTML link or Post ID depending on the $url parameter. If a link cannot be generated, the default value will be returned.


Source #

File: includes/course/ld-course-navigation.php


Changelog #

Changelog
Version Description
5.1.5 Added the $user parameter to control steps visibility.
4.11.0 Added support for quizzes.
2.1.0 Introduced.