Sorry I'm new to taxonomies & trying to learn quickly.
I've set up sectors and assigned a post to it. If I go to the post, I can see the URL has www.mydomain.com/sectors/auto/
How can I get auto from the URL? Thanks
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
I think you are looking for
$term_slug = get_query_var( 'term' ); $taxonomyName = get_query_var( 'taxonomy' ); $current_term = get_term_by( 'slug', $term_slug, $taxonomyName );
$sector = get_queried_object()->name;