In the twentyfifteen theme on the single.php template they are using the fairly new function 'the_post_navigation'. It seems to work for Custom Post Types (CPTs) but I cannot figure out how it does this.
Ultimately, what I would like to do is set the '$taxonomy' parameter in the below function to the current post. However, I cannot figure out how to get the taxonomy of a Post on a single post page.
// How to set $taxonomy to current post taxonomy
get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy = 'category' );