Get posts by term slug only

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?

Related posts

1 comment

  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

Comments are closed.