0
previous_post_link(); 
next_post_link();

this code should display previous link and then next link , its showing totally opposite , is this wordpress issue or this is something me doing wrong

3

From the Codex (emphasis mine):

In standard usage (within the default, unaltered loop) next_post_link will generate a link to a post that is newer (more recent) than the current post. This is in contrary to the similarly-named previous_posts_link, which will typically link to a page of posts that is older than the current batch.

It sounds like you just have different expectations about what "next" and "previous" means (I think if you asked me I would've guessed the opposite of this too).

If your - or more importantly, your readers' - conception of what next and previous means is different, then just swap the order of the links and change the labels to the opposite:

<?php next_post_link( '« %link' ); ?> | <?php previous_post_link( '%link »' ); ?> 
  • I just did this but for a logic ,I wanted to make it clear .Thanks to making me things clear – Maria Asghar Mar 7 '18 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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