WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I figured this would be a fairly comon thing. But I can't seem to find out how to do it. Or I'm just not using the correct search terms.

I've got a website with a hompage that lists all my posts, and 3 menu items that each list a category.

When I click on a post via a category, then I want the next|prev navigation to stay in that category.

When I click on a post via the homepage, I want the next|prev navigation to be chronolonical.

This is de navigation code which is in my single.php

<?php next_post_link('%link', '< Previous ', FALSE); ?> <?php previous_post_link('%link', '| Next >', FALSE); ?>

This is the correct setupt for navigating there from the homepage, but not when I get there via a category.

Please help, I've been banging my head on this for hours now!

Kind regards.

share|improve this question
<?php previous_post_link($format='&laquo %link', $link='%title', $in_same_cat = true); ?> TRY this $in_same_cat = true); This will make it work in same category – Kuldeep Daftary Dec 28 '12 at 15:40
@KuldeepDaftary, that should be posted as an answer, not a comment. – s_ha_dum Dec 28 '12 at 15:54
I was not sure if I was right! :P – Kuldeep Daftary Dec 28 '12 at 16:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.