带有自定义分类术语的get_next_post

I have a custom taxonomy called visitors_location, with the terms NL and INT. I have pages tagged that are tagged with either 1 or both these terms.
A visitor get a value NL or INT depending on his IP. When the visitor from eg. 'NL' sees a gird overview of pages with the taxonomy visitors_location he will only see the 'NL' pages. Up to here no problem.

But when he goes to a detail page the next page has to be tagged with NL as well. This code doesn't do the trick: get_next_post(true, '', 'visitors_location') because when a page is tagged with both 'NL' and 'INT' then, if the next page is only tagged with INT, it will be shows as well. So basically I need to be able to only include pages in get_next_post() that have an NL tag in this case. Any suggestion?

You can try this:

add_filter('get_next_post_where', 'fix_adjacent_post_where', 10, 5);
add_filter('get_previous_post_where', 'fix_adjacent_post_where', 10, 5);

function fix_adjacent_post_where($where, $in_same_term, $excluded_terms, $taxonomy, $post)
{
    global $wpdb;
    if ($in_same_term === true && $taxonomy === 'visitors_location')
    {
        $where .= " AND ID IN (
                        SELECT p.ID FROM {$wpdb->posts} AS p 
                        JOIN {$wpdb->term_relationships} AS tr ON tr.object_id=p.ID 
                        JOIN {$wpdb->term_taxonomy} AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id 
                        JOIN {$wpdb->terms} AS t ON t.term_id = tt.term_id 
                        WHERE t.name='NL' )";
    }
    return $where;
}

Make sure to replace 'NL' with a dynamic value that is in your case either 'NL' or 'INT'