Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

get_adjacent_post()

3 tags 1 category

get_adjacent_post() — Retrieves the adjacent post. Can either be next or previous post.

Inputs: $in_same_term (bool): Optional. Whether post should be in the same taxonomy term. Default false. $excluded_terms (int[]|string): Optional. Array or comma-separated list of excluded term IDs. Default empty string. $previous (bool): Optional. Whether to retrieve previous post. Default true. $taxonomy (string): 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.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…