I would like to get_the_category inside the_post_navigation. I created a custom field on Categories to assign a hex color to each category. I would like to use this color as the next / prev link background color when hovering on the post navigation.
How can I get the id of the category of the "next" or "prev" post?
I should clarify that every post has only two categories and I am only trying to get the id of the second category.
$next_post = get_next_post(); var_dump($next_post); $cats= get_the_terms($next_post->ID) var_dump($next_post); exit;
But what happens if there's more than one category on a post?