I was banging my head over this one. I did several searches and most people were recommending that people just use tags. I still don’t know how that would have helped. Before being told the answer I was thinking I would have to write a new Object in functions.php and re-write how next_post_link() works as editing the base code in WordPress is normally a no no. (Especially if you ever plan on updating the software).
Thankfully a guy named “Bob” recommended that I try something very simple that ended up working.
To get the Previous and Next post links to go to the next item in the category you need to use this code:
xhtml / PHP
The important thing in the lines of code that get’s next_post_link() and previous_post_link() to base the linking on category is to add “, TRUE”.
PHP
If you want to see the code in action just look at the bottom of this post. Since this is related to WordPress I’ve put it in the WordPress category. As long as there are no newer WordPress posts, this post should should only show a “previous post” link. It will take you back to the last post on WordPress.
I wanted to thank Bob again for helping me out with this info!
Daniel says
Yeah, but if you’ve got the post, categorized in 2 different categories, then what happens? 🙂
Jared Heinrichs says
That’s why I never add one post to more then one category. If I need to add an item to more then one category I use Post Tags. If you’re starting out fresh I highly recommend planning your organization with Categories as being more general and Post Tags as being more specific.