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

Never Miss a Tip from Brad Dalton

Get my latest web design tutorials, elegant coding solutions & useful tips.

5 Reasons Mad Mimi Works Better

  1. Sends From Your Email Address - More personal & higher open rate
  2. Cheapest - $42 for list of 10,000 emails, unlimited sends
  3. Ease of Use - The easiest system to create & setup campaigns
  4. RSS to E-Mail - Auto send list of latest posts
  5. Auto Send Any Number of Days - enables you to offer multiple newsletters at different frequencies.

Click here to create a free account.


  1. 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!

  2. 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 WP Sites does not reply to anonymous comment authors or approve loaded questions. Members get answers to unlimited questions.