Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Use WordPress’s Post Navigation Link block when your site uses a block theme. In a classic PHP theme, add previous_post_link() and next_post_link() to the single-post template inside The Loop. Both methods can restrict links to posts sharing a category, tag, or other taxonomy term.
Choose the method that matches your site
| Site or goal | Use | What it does |
|---|---|---|
| Block theme and visual editing | Post Navigation Link block | Adds links to the adjacent post from the Site Editor. |
| Classic PHP theme | previous_post_link() and next_post_link() |
Outputs links to adjacent posts from the single-post template. |
| Stay within a category, tag, or taxonomy | Block taxonomy filter or the functions’ same-term argument | Limits destinations to posts sharing a taxonomy term. |
| Move through archive or Query Loop result pages | Query Loop Pagination block or archive pagination functions | Changes the results page rather than opening an adjacent individual post. |
Add links in a block theme
Block themes let you place navigation in the post template without editing PHP files. The block is dynamic and server-rendered, with the name core/post-navigation-link.
- Open Appearance → Editor and edit the single-post template used by your theme. The template name and layout vary by theme.
- Place the cursor where the controls should appear, usually below the post content, and open the block inserter.
- Search for Next post or Previous post. In the editor you can also type
/next-postor/previous-post. - Add either variation, or add both to create a two-sided navigation row.
- In the block settings, choose whether to show the linked post title, a label, or both. Adjust alignment, typography, and spacing using the controls exposed by your theme.
- To keep destinations within a shared category, tag, or custom taxonomy, open Advanced and enable Filter by Taxonomy. WordPress then looks for an adjacent post sharing a term with the current post.
- Save the template and open several published posts on the live site. Confirm that each direction leads where the labels promise.
Add links in a classic theme
Classic themes use PHP template files. Put the functions in the single-post template, such as single.php or a more specific single-post template, and keep them inside The Loop so WordPress knows which post is current.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallBasic links
<?php
previous_post_link();
next_post_link();
?>
The default output uses the linked post title with directional arrows.
#1 Best Overall
Custom labels
<?php
previous_post_link( '%link', 'Previous post: %title' );
next_post_link( '%link', 'Next post: %title' );
?>
The %link token supplies the complete anchor, while %title inserts the destination post’s title. You can wrap the calls in your own container and style that container with CSS.
Restrict links to a shared term
The function arguments include a Boolean same-term option, excluded term IDs, and a taxonomy name. The taxonomy argument is used when same-term filtering is enabled; category is the default. A call can therefore be configured to find the adjacent post sharing a category, tag, or custom taxonomy term instead of searching all posts.
Rank #2
Because a post may have several terms, a same-term result can come from any shared term. If your site presents a numbered series, test posts that have multiple categories or tags and verify that the resulting order matches the intended sequence.
Recommended Free Tools
Protect customizations from theme updates
For PHP changes, use a child theme when appropriate. A child theme keeps your template modifications separate from the parent theme, so a parent-theme update does not overwrite them.
Understand what “next” and “previous” mean
These functions and the block follow WordPress’s chronological adjacent-post order. That may not match the reading order of a manually numbered tutorial series, product parts, or a course. Check the live destinations rather than assuming that “Next” means the next numbered item.
If no eligible adjacent post exists—such as at the beginning or end of the sequence—WordPress may omit that side of the navigation. Design the surrounding layout so a missing link does not leave an awkward empty control.
Rank #4
Do not confuse post navigation with pagination
Adjacent posts on a single-post page
previous_post_link(), next_post_link(), and the Post Navigation Link block open another individual post relative to the one being read.
Pages of archive results
On a blog index, category archive, search results page, or Query Loop, use pagination instead. In a block theme, add the Pagination block inside the Query Loop; it can include previous-page, page-number, and next-page controls. Classic themes use archive pagination functions such as next_posts_link() and previous_posts_link().
Best Value
One post split across several pages
If you divide one post with the <!--nextpage--> tag, use wp_link_pages(). That is in-post pagination, not navigation to another post.
Quick Recap
Troubleshoot unexpected destinations
- The controls are missing: confirm that you edited the template actually used for individual posts and that there is an eligible adjacent post.
- “Next” goes in the wrong direction: WordPress uses chronological adjacency, so inspect the publication order and reverse labels if your editorial sequence runs the other way.
- A link leaves the series: enable the block’s taxonomy filter or configure the PHP function’s same-term and taxonomy arguments.
- A same-term link still reaches an unexpected post: check for multiple shared terms; WordPress can match any term common to both posts.
- Changes disappear after a theme update: move classic-theme edits into a child theme rather than modifying the parent directly.
- You added links to an archive but wanted adjacent posts: replace archive pagination with post navigation in the single-post template, or use both in their appropriate page contexts.
Quick implementation checklist
- Identify whether the active theme is block-based or classic.
- Choose the single-post template, not an archive template, for adjacent-post links.
- Decide whether all chronological posts or only posts sharing a taxonomy term should be eligible.
- Use clear labels and test both directions on several posts.
- Check edge cases, including the first and last eligible posts and posts assigned to multiple terms.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

