Browse: Home / Functions /

learndash_previous_post_link

learndash_previous_post_link( string|null $default_value = '',  string|bool $url = false,  WP_Post|null $post = null )

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


Description #

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


Parameters #

$default_value

(string|null) (Optional) Default previous 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


Return #

(string|int) Previous 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
4.11.0 Added support for quizzes.
2.1.0 Introduced.