WPDev.one
Core Function
View Source on Trac ↗

get_previous_post_link()

get_previous_post_link( mixed $format = '« %link', mixed $link = '%title', mixed $in_same_term = false, mixed $excluded_terms = '', mixed $taxonomy = 'category' )

Retrieves the previous post link that is adjacent to the current post.

Parameters 2 required

Name / Type Description
$format
string

Optional. Link anchor format. Default '« %link'.

$link
string

Optional. Link permalink format. Default '%title'.

bool

$in_same_term Optional. Whether link should be in the same taxonomy term. Default false.

Required
mixed

(int[] | string) $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.

Required
$taxonomy
string

Optional. Taxonomy, if `$in_same_term` is true. Default 'category'.

Return Value

(string)
The link URL of the previous post in relation to the current post.

Function Information

Since Version
3.7.0
Source File
wp-includes/link-template.php
Advertisement