Title: Next and Previous Posts problem
Last modified: June 27, 2017

---

# Next and Previous Posts problem

 *  [ostregheta](https://wordpress.org/support/users/ostregheta/)
 * (@ostregheta)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/next-and-previous-posts-problem/)
 * Adding Next and Previous Posts under post pages it does not take count of category
   of post, as a result if somebody click on next post bottom it may goes in one
   other category post and get confused about site navigation…….
    Is there a way
   to set Next and Previous Posts bottom to change post in the same category? Something
   like set value true in $in_same_term in previous_post_link and next_post_link
   wp function (I don’t know if you are using standard wp function or not)? Thank
   you

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [ostregheta](https://wordpress.org/support/users/ostregheta/)
 * (@ostregheta)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/next-and-previous-posts-problem/#post-9265995)
 * It should be in core-nextprev.php file and it seams it does not pass to next_post_link
   function the category to look for…
    in my site for exemple here [http://www.canilediarzignano.it/category/adottati/page/2/](http://www.canilediarzignano.it/category/adottati/page/2/)
   you see that previous page refer to one category, next page to another… Thank
   you
 *  Theme Author [OptimizerWP](https://wordpress.org/support/users/layerthemes/)
 * (@layerthemes)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/next-and-previous-posts-problem/#post-9275871)
 * Please go to Appearance > Editor and select core-nextprev.php and replace all
   the code with the one you find here: [https://pastebin.com/raw/TnBnZ6aY](https://pastebin.com/raw/TnBnZ6aY)
 * Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Next and Previous Posts problem’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/optimizer/0.7.4/screenshot.png)
 * Optimizer
 * [Support Threads](https://wordpress.org/support/theme/optimizer/)
 * [Active Topics](https://wordpress.org/support/theme/optimizer/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/optimizer/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/optimizer/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [OptimizerWP](https://wordpress.org/support/users/layerthemes/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/next-and-previous-posts-problem/#post-9275871)
 * Status: not resolved