WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an array of term IDs that I'd like to filter my query with, but most wordpress functions seem to need the 'taxonomy' field entered too. Is there a reason for this?

Passing the taxonomy ID seems to be unnecessary, if all term IDs are unique anyway, unless I'm missing something.

As it seems as though I can't query this with Wordpress direct, I'd be looking for something like:

$terms_array = get_term_ids( get_the_ID() );

Any ideas of the best way to pull this off?

share|improve this question

Try out this code and see if it works for you, I just cooked it up real quick and haven't tested it, so it may be way off base, but the concept is there.

$tax_args = array(
    'public' => true
$taxonomies = get_taxonomies( $tax_args, 'names', 'or' );

$term_args = array(
    'fields' => 'ids'
$terms = get_terms( $taxonomies, $term_args );

Docs: get_taxonomies(), get_terms()

share|improve this answer
Looks good! I'll check this in the morning & let you know. – mjjwatson Feb 4 '12 at 20:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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