Check if tag, category or author on archive.php
you can use it just like you posted which is safe and would do the job just fine: if (is_author()) { $author = (isset($_GET[‘author_name’])) ? get_user_by(‘slug’, $author_name) : get_userdata(intval($author)); } elseif (is_category()) { //this will work in categories tags or custom taxonomy $term_slug = get_query_var( ‘term’ ); $taxonomyName = get_query_var( ‘taxonomy’ ); $current_term = get_term_by( … Read more