I've been using get_adjacent_post() to determine the previous and next posts. How would I go about determining the next and previous links to posts matching the same tag as the current post? It seems this function allows you to do this with posts in the same category, but not with the same tag.

link|improve this question
feedback

1 Answer

get_adjacent_posts() has several filters for components of generated SQL query, including:

  • get_{$adjacent}_post_join
  • get_{$adjacent}_post_where

Where $adjacent can be next or previous. Source.

So there is no easy way to flip it from categories to tags, but you can manipulate SQL query and add own conditions (or change to them completely).

link|improve this answer
+1 for this one. – kaiser Feb 13 '11 at 15:28
feedback

Your Answer

 
or
required, but never shown

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