Get terms from multiple taxonomies

I have to get all the terms from four taxonomies:

  • vehicle_safely_features
  • vehicle_exterior_features
  • vehicle_interior_features
  • vehicle_extras

I tried this:

$terms = get_terms( array( 
    'taxonomy' => 'vehicle_safely_features',
    'vehicle_exterior_features',
    'vehicle_interior_features',
    'vehicle_extras'
) );

But, it only gets terms of vehicle_safely_features and not all of the taxonomies.

2 Answers
2

If you want to retrieve multiple taxonomies you need to put the four taxonomies in an array, you are doing this, but you have put taxonomy=> in the array.

$terms = get_terms(
          'taxonomy' => array(
                         'vehicle_safely_features',
                         'vehicle_exterior_features',
                         'vehicle_interior_features',
                         'vehicle_extras')
);

Hope it helps

Leave a Comment