When I'm on a single post for a custom post type, I want to be able to grab the
name of the taxonomy term so I can insert them into a link. Below is what I've tried but it doesn't seem to work.
<?php $term_slug = get_queried_object()->slug; $term_name = get_queried_object()->name; echo '<span class="back-button"><a href="/portfolio/' .$term_slug. '">← Back to ' .$term_name. '</a></span>'; ?>
So for example, if I'm on a single post for the custom post type "Projects" and the taxonomy term is "Album Artwork," I want to be able to grab the
slug "album-artwork" and the name "Album Artwork" so I can put them into the link. How can I do this?