I'm looking for a conditional tag to check if a taxonomy archive page(link) is displayed on my search results page.

is_tax(); only seems to check if the current page is a taxonomy archive page and can't be used. has_term('','my_taxonomy') works fine for posts using the taxonomy but obviously not the taxonomy archive.

I've searched the Codex but start to doubt if this is even possible?

  • Taxonomy archives aren’t returned in search results. Only posts and pages. – Jacob Peattie May 11 '20 at 10:48
  • 1
    They can be returned with the use of Ajax Search Pro plugin which replaces the default search. But the default behaviour probably explains the lack of a conditional tag for a taxonomy archive. – NielsPilon May 11 '20 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.