If on term-page -> get the current term?
You’ll want get_queried_object(). This is a very generic function – and simply returns the queried object- so a single post, this would be a post object. For instance, the return object may be of the form: Object ( [term_id] => 299 [name] => test [slug] => test [term_group] => 0 [term_taxonomy_id] => 317 [taxonomy] => … Read more