Version 1.2

This version requires PHP 5. If you’re getting an error on activation, it means you’re running PHP 4.

Two template tags have been added:

If you have posts in multiple categories, you can use get_referrer_category() to retrieve the category object, based on the referrer url.

get_referrer_url() returns the full URL of the referrer.

Also, there are two extra arguments for previous_post_smart() and next_post_smart(): $in_same_cat and $excluded_categories.

This is how the function prototype looks like:

previous_post_smart(
	$format = '« %link',
	$title = '%title',
	$fallback = true,
	$in_same_cat = false,
	$excluded_categories = ''
);

Version 1.1

Two important bugfixes:

  1. Works with sets of posts split on multiple pages (up to 500 posts).
  2. Works correctly if you open multiple tabs on the same site.

Version 1.0

The default previous_post_link() and next_post_link() have an option to restrict adjacent posts to the current category. This plugin takes one step further:

If you visit an archive page (category, tag, date, author, search etc.) and then visit a single post from that page, the previous_post_smart() and next_post_smart() will point only to the other posts in that archive page.

This is particularly useful for photoblogs (that’s where I use it).

If there isn’t an adjacent post, it will use the normal template tags.