2

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.

4

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

  • Thanks Benoti that did the trick I knew I was missing something. – apoorv Nov 15 '16 at 8:03
1

Incase someone get an error due to the => use below

$termsArray = get_the_terms(
    $post->ID,
    array(
        'tax1',
        'tax2',
        'tax3'
    )
)

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.