Retrieves the previous post that is adjacent to the current post.
$in_same_termbooloptional
Default:false
$excluded_termsint[]|stringoptional
Default:''
$taxonomystringoptional
$in_same_term is true. Default 'category'.Default:'category'
$post is not set.function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
return get_adjacent_post( $in_same_term, $excluded_terms, true, $taxonomy );
}
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_previous_post