Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to use next_post_link and prev_post_link to return only the next post in my custom taxonomy of a custom post type. I have a custom post type called "work_posts" which has the taxonomy "work_categories" assigned. The category I want to show is called 'all'. I looked up get_adjacent_post in the "link-template.php" which has a few filters which should make it possible to make such a query but my SQL is not good enough to make the right query. The hooks are:

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

if I log a query in the join hook I get:

INNER JOIN wp_term_relationships AS tr 
ON p.ID = tr.object_id 
INNER JOIN wp_term_taxonomy tt 
ON tr.term_taxonomy_id = tt.term_taxonomy_id 
AND tt.taxonomy = 'category' 
AND tt.term_id IN (3)

how do I modify this to only show posts from my custom taxonomy?

share|improve this question
    
Why not use query_posts or wp_query ? What's the need for sql here –  Bainternet Jan 29 '11 at 16:23
add comment

2 Answers

up vote 2 down vote accepted

Take a look at http://wordpress.org/extend/plugins/ambrosite-nextprevious-post-link-plus/ Its a plugin that adds extra missing functionality to next_post_link and prev_post_link functions.

share|improve this answer
    
Hi בניית אתרים, thanks for your answer, worked perfect. –  Thomas Jan 30 '11 at 23:06
add comment

I was with the same problem.

The correct plugin to be used to fix the problem is this.

And it seems that a bug is already reported here.

share|improve this answer
    
thanks for pointing out the bug and another plugin. –  GhostToast Sep 28 '12 at 14:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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