0

This one might be a simple question, but it's driving me nuts :)

I'm trying to make an admin settings page on the wp-admin side for which I need to get all the values of a certain category.

This is part of my test code:

$terms = get_terms( array(
    'taxonomy' => 'my-category',
    'hide_empty' => false,
) );
echo '<pre>';
var_dump($terms);
echo '</pre>';

But this returns an error. Something like "invalid taxonomy". When I leave the 'taxonomy' arg from get_terms() it returns all the terms successfully. ( but of course I need to filter it by my tax term.

Anyone knows what's up? :)

Any help would be highly appreciated.

Gufran Hasan
  • 8,910
  • 7
  • 38
  • 51
Tim
  • 861
  • 1
  • 12
  • 27

1 Answers1

0

Please try this code

get_terms(  array('taxonomy' => 'any_taxonomy','hide_empty' => false) );

https://developer.wordpress.org/reference/functions/get_terms/

Gufran Hasan
  • 8,910
  • 7
  • 38
  • 51