I am using next_post_link() , and I want to use the parameters shown in the documentation to restrict it to go to the next post with the same term for a custom taxonomy called "years".
The line I am using is
<?php next_post_link( '%link', __( 'Next', 'twentyeleven' ), TRUE, '', 'years' ); ?>
This does not display a "next" link at all. However, when I remove the optional parameters, it does display the "next" link.
The page in question is http://stage.newurbanarts.org/mentors/alejandra-peralta/ (htaccess username: guest / password: stackexchange).
I put some debugging code into it near the top to show the output of
It should show the "Next" link which would go to http://stage.newurbanarts.org/mentors/alison-rutsch/ - note in the debugging code that this post has the same terms for "years".
Update: I enabled some debugging - printing all the warnings on the page resulted in the page being unintelligible with many warnings coming from various plugins. I put all the info into this log file, and the screen now displays where the "next" link should be:
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') WHERE p.post_date > '2013-09-30 12:05:35' AND p.post_type = 'mentors' AND p.po' at line 1] SELECT p.* FROM wp_posts AS p 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 () WHERE p.post_date > '2013-09-30 12:05:35' AND p.post_type = 'mentors' AND p.post_status = 'publish' AND tt.taxonomy = 'category' ORDER BY p.post_date ASC LIMIT 1
WordPress 3.4.1 (It's an old site that I just picked up for an organization that has not updated it for a while. Depends on many old plugins, so upgrading may break things, but I will give that a shot as per the answers.)
Also, here's just the template file in question.