1

What I'm looking to do is build a shortcode to that will display a list of posts based on the taxonomy slugs passed to it. But as far as I can tell, you can't use just a term's slug to pull posts in without having to also specify the taxonomy it's in.

Is it possible to get posts or other taxonomy based data (term meta, name, etc) with just the terms slug, and without the specific taxonomy it's in?

1

If you look at source of get_term() it does hard check for taxonomy and for good reasons (caching, collisions, etc).

I see two possible approaches:

  • look for term in every appropriate taxonomy until you match
  • try to query for term by search or name__like in multiple taxonomies using get_terms() and work with results

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.