The $taxonomy
parameter for both next_post_link
and previous_post_link
was introduced in Wordpress version 3.8.
When the $in_same_term
parameter is set to true, you need to set the $taxonomy
parameter to the desired taxonomy. By default, it is set to category
. Remember, post_format
is also a taxonomy
Example:
next_post_link( '%link', 'Next post in category', TRUE, ' ', 'post_format' );
Just a note, do not use next_post
and previous_post
. It has already being depreciated as from Wordpress version 2.0.0. See wp-includes/deprecated.php#L121 and wp-includes/deprecated.php#L158
EDIT
The single post links will automatically page between posts within the same post type as the current post's post type is used to retrieve the adjacent posts. Check the source code, get_adjacent_post()
which is used by the next and previous post links. Pay particular attention to line 1550 ( currently for version 4.1 )
1550 $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.post_type = %s AND p.post_status = 'publish' $where", $current_post_date, $post->post_type ), $in_same_term, $excluded_terms );