get_previous_post() – Retrieves the previous post that is adjacent to the current post.
You appear to be a bot. Output may be restricted
Description
Retrieves the previous post that is adjacent to the current post.
Usage
$WP_Post|null|string = get_previous_post( $in_same_term, $excluded_terms, $taxonomy );
Parameters
- $in_same_term
- ( bool ) optional – Optional. Whether post should be in the same taxonomy term. Default false.
- $excluded_terms
- ( int[]|string ) optional – Optional. Array or comma-separated list of excluded term IDs. Default empty.
- $taxonomy
- ( string ) optional default: category – Optional. Taxonomy, if
$in_same_term
is true. Default 'category'.
Returns
WP_Post|null|string Post object if successful. Null if global $post
is not set. Empty string if no corresponding post exists.
Source
File name: wordpress/wp-includes/link-template.php
Lines:
1 to 3 of 3
function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) { return get_adjacent_post( $in_same_term, $excluded_terms, true, $taxonomy ); }