Previous & Next Single Post Navigation Links In WordPress

Connecting all your posts together is not a bad way to make sure all of them are indexed in the search results.

Its also not a bad way to help increase a few extra page views as some of your readers will click your next & previous post links.

But lets face it, if you’ve setup and submitted a compliant XML sitemap you shouldn’t have anything to worry about it right?


In reality, there’s always something to worry about like:

  • why aren’t all my url’s indexed!
  • and why aren’t i getting more traffic!!

Lets take a look at the different ways you can add next and previous navigation links to different WordPress child and parent themes.

Adding Single Post Nav Links Using Code

To add post nav links to themes which don’t already include this function in the parent or child themes files, follow these steps.

You can simply add the template tags directly to your parent theme’s single.php file

Your single.php file is one of your templates used when displaying all single posts.

Add this code before the closing WordPress loop like i have done in this screenshot.

I have removed the text parameter in green so only the previous and next post titles will be displayed.

Previous & Next Post Function
Add the Previous & Next post code before the // end of the loop.

This code will display the post titles rather than the words previous and next post.

If you want to display the words, previous and next or custom text instead of your post titles, simply change the parameter in the code from yes to no. This will remove the post titles linked to your previous and next posts and only display the text in green which you can customize.

You could also use previous and next post with both post titles as well by changing the third parameter to yes as well as adding the previous and next text in the second parameter in green.

Display Position

The navigation links will display on all single posts depending on where you paste the code in your single.php template file.

The most popular location is immediately after your post content so you would paste the code before your comments template like this:

Display Nav Links Before Comments Template
Display Post Navigation Links Before Comments Template & After Post Content On Single Posts

Adding this code to your parent themes single.php template file is not exactly best practice because you’ll lose this function when you update the theme.

Better to hook it in using an after post content action hook (theme specific) and custom function.

Post Navigation Link Plugins

There’s many of these plugins in the WordPress plugins directory.

Update for Genesis users: Genesis 2.0 will include single post navigation so no need to add it manually.

Next Post

In the next post we’ll take a look at the options for adding previous and next page navigation links using code and plugins.

What do you do for post nav links?

Install a plugin, add code or already included in your theme?

More Post Navigation Solutions

Get 50% OFF the fastest WordPress hosting for the first 3 Months.

Expiration Date: Expires 1/1/15 WP Engine hosting Rules: Only valid for new customers with Personal, Professional, and Business Plans. Not intended for internal use by wpengine affiliates.


  1. Tess says

    I am using the most recent post (1 post) on the homepage so that the next day’s title is displayed on the homepage and nothing else.

    Currently, when you click on the “Older Posts” link on the homepage eg goes to: instead of

    The problem is that I have different backgrounds on each post so I want them to be shown rather than the post displayed over the homepage background.

    Any ideas how to achieve this?


  2. Sheri says

    Thank you so so much! I’m not very tech savy, and code confuses me. Ok. Let’s be honest. Many things confuse me. But your tutorial was awesome. Not only did I add the code, but I managed not to break my site. You’ve made me a believer!

  3. Kim Larsen says

    Hey, I followed your tutorial, and it did what it was suppose to do, which of course is great! ;-)

    BUT, I was wondering if you could suggest a code to make the navigation only apply to the CATEGORY that you are currently reading? Right now this code takes you through ALL your posts in one long line.


Leave a Reply

Your feedback is always appreciated.

Your feedback is always welcome & appreciated however you must be logged in to get solutions for questions asked in the comments.